#line 1 "..\\app\\gt_alarm\\gt_event.c"



 
#line 1 "..\\app\\APP\\gtlib.h"








#line 1 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\string.h"
 
 
 
 




 








 












#line 38 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\string.h"


  
  typedef unsigned int size_t;








extern __declspec(__nothrow) void *memcpy(void * __restrict  ,
                    const void * __restrict  , size_t  ) __attribute__((__nonnull__(1,2)));
   




 
extern __declspec(__nothrow) void *memmove(void *  ,
                    const void *  , size_t  ) __attribute__((__nonnull__(1,2)));
   







 
extern __declspec(__nothrow) char *strcpy(char * __restrict  , const char * __restrict  ) __attribute__((__nonnull__(1,2)));
   




 
extern __declspec(__nothrow) char *strncpy(char * __restrict  , const char * __restrict  , size_t  ) __attribute__((__nonnull__(1,2)));
   





 

extern __declspec(__nothrow) char *strcat(char * __restrict  , const char * __restrict  ) __attribute__((__nonnull__(1,2)));
   




 
extern __declspec(__nothrow) char *strncat(char * __restrict  , const char * __restrict  , size_t  ) __attribute__((__nonnull__(1,2)));
   






 






 

extern __declspec(__nothrow) int memcmp(const void *  , const void *  , size_t  ) __attribute__((__nonnull__(1,2)));
   





 
extern __declspec(__nothrow) int strcmp(const char *  , const char *  ) __attribute__((__nonnull__(1,2)));
   




 
extern __declspec(__nothrow) int strncmp(const char *  , const char *  , size_t  ) __attribute__((__nonnull__(1,2)));
   






 
extern __declspec(__nothrow) int strcasecmp(const char *  , const char *  ) __attribute__((__nonnull__(1,2)));
   





 
extern __declspec(__nothrow) int strncasecmp(const char *  , const char *  , size_t  ) __attribute__((__nonnull__(1,2)));
   






 
extern __declspec(__nothrow) int strcoll(const char *  , const char *  ) __attribute__((__nonnull__(1,2)));
   







 

extern __declspec(__nothrow) size_t strxfrm(char * __restrict  , const char * __restrict  , size_t  ) __attribute__((__nonnull__(2)));
   













 


#line 185 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\string.h"
extern __declspec(__nothrow) void *memchr(const void *  , int  , size_t  ) __attribute__((__nonnull__(1)));

   





 

#line 201 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\string.h"
extern __declspec(__nothrow) char *strchr(const char *  , int  ) __attribute__((__nonnull__(1)));

   




 

extern __declspec(__nothrow) size_t strcspn(const char *  , const char *  ) __attribute__((__nonnull__(1,2)));
   




 

#line 224 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\string.h"
extern __declspec(__nothrow) char *strpbrk(const char *  , const char *  ) __attribute__((__nonnull__(1,2)));

   




 

#line 239 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\string.h"
extern __declspec(__nothrow) char *strrchr(const char *  , int  ) __attribute__((__nonnull__(1)));

   





 

extern __declspec(__nothrow) size_t strspn(const char *  , const char *  ) __attribute__((__nonnull__(1,2)));
   



 

#line 262 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\string.h"
extern __declspec(__nothrow) char *strstr(const char *  , const char *  ) __attribute__((__nonnull__(1,2)));

   





 

extern __declspec(__nothrow) char *strtok(char * __restrict  , const char * __restrict  ) __attribute__((__nonnull__(2)));
extern __declspec(__nothrow) char *_strtok_r(char *  , const char *  , char **  ) __attribute__((__nonnull__(2,3)));

extern __declspec(__nothrow) char *strtok_r(char *  , const char *  , char **  ) __attribute__((__nonnull__(2,3)));

   

































 

extern __declspec(__nothrow) void *memset(void *  , int  , size_t  ) __attribute__((__nonnull__(1)));
   



 
extern __declspec(__nothrow) char *strerror(int  );
   





 
extern __declspec(__nothrow) size_t strlen(const char *  ) __attribute__((__nonnull__(1)));
   



 

extern __declspec(__nothrow) size_t strlcpy(char *  , const char *  , size_t  ) __attribute__((__nonnull__(1,2)));
   
















 

extern __declspec(__nothrow) size_t strlcat(char *  , const char *  , size_t  ) __attribute__((__nonnull__(1,2)));
   






















 

extern __declspec(__nothrow) void _membitcpybl(void *  , const void *  , int  , int  , size_t  ) __attribute__((__nonnull__(1,2)));
extern __declspec(__nothrow) void _membitcpybb(void *  , const void *  , int  , int  , size_t  ) __attribute__((__nonnull__(1,2)));
extern __declspec(__nothrow) void _membitcpyhl(void *  , const void *  , int  , int  , size_t  ) __attribute__((__nonnull__(1,2)));
extern __declspec(__nothrow) void _membitcpyhb(void *  , const void *  , int  , int  , size_t  ) __attribute__((__nonnull__(1,2)));
extern __declspec(__nothrow) void _membitcpywl(void *  , const void *  , int  , int  , size_t  ) __attribute__((__nonnull__(1,2)));
extern __declspec(__nothrow) void _membitcpywb(void *  , const void *  , int  , int  , size_t  ) __attribute__((__nonnull__(1,2)));
extern __declspec(__nothrow) void _membitmovebl(void *  , const void *  , int  , int  , size_t  ) __attribute__((__nonnull__(1,2)));
extern __declspec(__nothrow) void _membitmovebb(void *  , const void *  , int  , int  , size_t  ) __attribute__((__nonnull__(1,2)));
extern __declspec(__nothrow) void _membitmovehl(void *  , const void *  , int  , int  , size_t  ) __attribute__((__nonnull__(1,2)));
extern __declspec(__nothrow) void _membitmovehb(void *  , const void *  , int  , int  , size_t  ) __attribute__((__nonnull__(1,2)));
extern __declspec(__nothrow) void _membitmovewl(void *  , const void *  , int  , int  , size_t  ) __attribute__((__nonnull__(1,2)));
extern __declspec(__nothrow) void _membitmovewb(void *  , const void *  , int  , int  , size_t  ) __attribute__((__nonnull__(1,2)));
    














































 







#line 494 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\string.h"



 

#line 10 "..\\app\\APP\\gtlib.h"
#line 1 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\stdlib.h"
 
 
 




 
 



 













  


 








#line 46 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\stdlib.h"


  
  typedef unsigned int size_t;










    



    typedef unsigned short wchar_t;  
#line 75 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\stdlib.h"

typedef struct div_t { int quot, rem; } div_t;
    
typedef struct ldiv_t { long int quot, rem; } ldiv_t;
    

typedef struct lldiv_t { __int64 quot, rem; } lldiv_t;
    


#line 96 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\stdlib.h"
   



 

   




 
#line 115 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\stdlib.h"
   


 
extern __declspec(__nothrow) int __aeabi_MB_CUR_MAX(void);

   




 

   




 




extern __declspec(__nothrow) double atof(const char *  ) __attribute__((__nonnull__(1)));
   



 
extern __declspec(__nothrow) int atoi(const char *  ) __attribute__((__nonnull__(1)));
   



 
extern __declspec(__nothrow) long int atol(const char *  ) __attribute__((__nonnull__(1)));
   



 

extern __declspec(__nothrow) __int64 atoll(const char *  ) __attribute__((__nonnull__(1)));
   



 


extern __declspec(__nothrow) double strtod(const char * __restrict  , char ** __restrict  ) __attribute__((__nonnull__(1)));
   

















 

extern __declspec(__nothrow) float strtof(const char * __restrict  , char ** __restrict  ) __attribute__((__nonnull__(1)));
extern __declspec(__nothrow) long double strtold(const char * __restrict  , char ** __restrict  ) __attribute__((__nonnull__(1)));
   

 

extern __declspec(__nothrow) long int strtol(const char * __restrict  ,
                        char ** __restrict  , int  ) __attribute__((__nonnull__(1)));
   



























 
extern __declspec(__nothrow) unsigned long int strtoul(const char * __restrict  ,
                                       char ** __restrict  , int  ) __attribute__((__nonnull__(1)));
   


























 

 
extern __declspec(__nothrow) __int64 strtoll(const char * __restrict  ,
                               char ** __restrict  , int  ) __attribute__((__nonnull__(1)));
   




 
extern __declspec(__nothrow) unsigned __int64 strtoull(const char * __restrict  ,
                                         char ** __restrict  , int  ) __attribute__((__nonnull__(1)));
   



 

extern __declspec(__nothrow) int rand(void);
   







 
extern __declspec(__nothrow) void srand(unsigned int  );
   






 

struct _rand_state { int __x[57]; };
extern __declspec(__nothrow) int _rand_r(struct _rand_state *);
extern __declspec(__nothrow) void _srand_r(struct _rand_state *, unsigned int);
struct _ANSI_rand_state { int __x[1]; };
extern __declspec(__nothrow) int _ANSI_rand_r(struct _ANSI_rand_state *);
extern __declspec(__nothrow) void _ANSI_srand_r(struct _ANSI_rand_state *, unsigned int);
   


 

extern __declspec(__nothrow) void *calloc(size_t  , size_t  );
   



 
extern __declspec(__nothrow) void free(void *  );
   





 
extern __declspec(__nothrow) void *malloc(size_t  );
   



 
extern __declspec(__nothrow) void *realloc(void *  , size_t  );
   













 

extern __declspec(__nothrow) int posix_memalign(void **  , size_t  , size_t  );
   









 

typedef int (*__heapprt)(void *, char const *, ...);
extern __declspec(__nothrow) void __heapstats(int (*  )(void *  ,
                                           char const *  , ...),
                        void *  ) __attribute__((__nonnull__(1)));
   










 
extern __declspec(__nothrow) int __heapvalid(int (*  )(void *  ,
                                           char const *  , ...),
                       void *  , int  ) __attribute__((__nonnull__(1)));
   














 
extern __declspec(__nothrow) __declspec(__noreturn) void abort(void);
   







 

extern __declspec(__nothrow) int atexit(void (*  )(void)) __attribute__((__nonnull__(1)));
   




 
#line 415 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\stdlib.h"


extern __declspec(__nothrow) __declspec(__noreturn) void exit(int  );
   












 

extern __declspec(__nothrow) __declspec(__noreturn) void _Exit(int  );
   







      

extern __declspec(__nothrow) char *getenv(const char *  ) __attribute__((__nonnull__(1)));
   









 

extern __declspec(__nothrow) int  system(const char *  );
   









 

extern  void *bsearch(const void *  , const void *  ,
              size_t  , size_t  ,
              int (*  )(const void *, const void *)) __attribute__((__nonnull__(1,2,5)));
   












 
#line 503 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\stdlib.h"


extern  void qsort(void *  , size_t  , size_t  ,
           int (*  )(const void *, const void *)) __attribute__((__nonnull__(1,4)));
   









 

#line 532 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\stdlib.h"

extern __declspec(__nothrow) __pure int abs(int  );
   



 

extern __declspec(__nothrow) __pure div_t div(int  , int  );
   









 
extern __declspec(__nothrow) __pure long int labs(long int  );
   



 




extern __declspec(__nothrow) __pure ldiv_t ldiv(long int  , long int  );
   











 







extern __declspec(__nothrow) __pure __int64 llabs(__int64  );
   



 




extern __declspec(__nothrow) __pure lldiv_t lldiv(__int64  , __int64  );
   











 
#line 613 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\stdlib.h"



 
typedef struct __sdiv32by16 { int quot, rem; } __sdiv32by16;
typedef struct __udiv32by16 { unsigned int quot, rem; } __udiv32by16;
    
typedef struct __sdiv64by32 { int rem, quot; } __sdiv64by32;

__value_in_regs extern __declspec(__nothrow) __pure __sdiv32by16 __rt_sdiv32by16(
     int  ,
     short int  );
   

 
__value_in_regs extern __declspec(__nothrow) __pure __udiv32by16 __rt_udiv32by16(
     unsigned int  ,
     unsigned short  );
   

 
__value_in_regs extern __declspec(__nothrow) __pure __sdiv64by32 __rt_sdiv64by32(
     int  , unsigned int  ,
     int  );
   

 



 
extern __declspec(__nothrow) unsigned int __fp_status(unsigned int  , unsigned int  );
   







 























 
extern __declspec(__nothrow) int mblen(const char *  , size_t  );
   












 
extern __declspec(__nothrow) int mbtowc(wchar_t * __restrict  ,
                   const char * __restrict  , size_t  );
   















 
extern __declspec(__nothrow) int wctomb(char *  , wchar_t  );
   













 





 
extern __declspec(__nothrow) size_t mbstowcs(wchar_t * __restrict  ,
                      const char * __restrict  , size_t  ) __attribute__((__nonnull__(2)));
   














 
extern __declspec(__nothrow) size_t wcstombs(char * __restrict  ,
                      const wchar_t * __restrict  , size_t  ) __attribute__((__nonnull__(2)));
   














 

extern __declspec(__nothrow) void __use_realtime_heap(void);
extern __declspec(__nothrow) void __use_realtime_division(void);
extern __declspec(__nothrow) void __use_two_region_memory(void);
extern __declspec(__nothrow) void __use_no_heap(void);
extern __declspec(__nothrow) void __use_no_heap_region(void);

extern __declspec(__nothrow) char const *__C_library_version_string(void);
extern __declspec(__nothrow) int __C_library_version_number(void);











#line 867 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\stdlib.h"


 

#line 11 "..\\app\\APP\\gtlib.h"
#line 1 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\stdio.h"
 
 
 





 






 













#line 38 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\stdio.h"


  
  typedef unsigned int size_t;    








 
 

 
  typedef struct __va_list __va_list;





   




 




typedef struct __fpos_t_struct {
    unsigned __int64 __pos;
    



 
    struct {
        unsigned int __state1, __state2;
    } __mbstate;
} fpos_t;
   


 


   

 

typedef struct __FILE FILE;
   






 

extern FILE __stdin, __stdout, __stderr;
extern FILE *__aeabi_stdin, *__aeabi_stdout, *__aeabi_stderr;

#line 129 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\stdio.h"
    

    

    





     



   


 


   


 

   



 

   


 




   


 





    


 






extern __declspec(__nothrow) int remove(const char *  ) __attribute__((__nonnull__(1)));
   





 
extern __declspec(__nothrow) int rename(const char *  , const char *  ) __attribute__((__nonnull__(1,2)));
   








 
extern __declspec(__nothrow) FILE *tmpfile(void);
   




 
extern __declspec(__nothrow) char *tmpnam(char *  );
   











 

extern __declspec(__nothrow) int fclose(FILE *  ) __attribute__((__nonnull__(1)));
   







 
extern __declspec(__nothrow) int fflush(FILE *  );
   







 
extern __declspec(__nothrow) FILE *fopen(const char * __restrict  ,
                           const char * __restrict  ) __attribute__((__nonnull__(1,2)));
   








































 
extern __declspec(__nothrow) FILE *freopen(const char * __restrict  ,
                    const char * __restrict  ,
                    FILE * __restrict  ) __attribute__((__nonnull__(2,3)));
   








 
extern __declspec(__nothrow) void setbuf(FILE * __restrict  ,
                    char * __restrict  ) __attribute__((__nonnull__(1)));
   




 
extern __declspec(__nothrow) int setvbuf(FILE * __restrict  ,
                   char * __restrict  ,
                   int  , size_t  ) __attribute__((__nonnull__(1)));
   















 
#pragma __printf_args
extern __declspec(__nothrow) int fprintf(FILE * __restrict  ,
                    const char * __restrict  , ...) __attribute__((__nonnull__(1,2)));
   


















 
#pragma __printf_args
extern __declspec(__nothrow) int _fprintf(FILE * __restrict  ,
                     const char * __restrict  , ...) __attribute__((__nonnull__(1,2)));
   



 
#pragma __printf_args
extern __declspec(__nothrow) int printf(const char * __restrict  , ...) __attribute__((__nonnull__(1)));
   




 
#pragma __printf_args
extern __declspec(__nothrow) int _printf(const char * __restrict  , ...) __attribute__((__nonnull__(1)));
   



 
#pragma __printf_args
extern __declspec(__nothrow) int sprintf(char * __restrict  , const char * __restrict  , ...) __attribute__((__nonnull__(1,2)));
   






 
#pragma __printf_args
extern __declspec(__nothrow) int _sprintf(char * __restrict  , const char * __restrict  , ...) __attribute__((__nonnull__(1,2)));
   



 

#pragma __printf_args
extern __declspec(__nothrow) int snprintf(char * __restrict  , size_t  ,
                     const char * __restrict  , ...) __attribute__((__nonnull__(3)));
   















 

#pragma __printf_args
extern __declspec(__nothrow) int _snprintf(char * __restrict  , size_t  ,
                      const char * __restrict  , ...) __attribute__((__nonnull__(3)));
   



 
#pragma __scanf_args
extern __declspec(__nothrow) int fscanf(FILE * __restrict  ,
                    const char * __restrict  , ...) __attribute__((__nonnull__(1,2)));
   






























 
#pragma __scanf_args
extern __declspec(__nothrow) int _fscanf(FILE * __restrict  ,
                     const char * __restrict  , ...) __attribute__((__nonnull__(1,2)));
   



 
#pragma __scanf_args
extern __declspec(__nothrow) int scanf(const char * __restrict  , ...) __attribute__((__nonnull__(1)));
   






 
#pragma __scanf_args
extern __declspec(__nothrow) int _scanf(const char * __restrict  , ...) __attribute__((__nonnull__(1)));
   



 
#pragma __scanf_args
extern __declspec(__nothrow) int sscanf(const char * __restrict  ,
                    const char * __restrict  , ...) __attribute__((__nonnull__(1,2)));
   








 
#pragma __scanf_args
extern __declspec(__nothrow) int _sscanf(const char * __restrict  ,
                     const char * __restrict  , ...) __attribute__((__nonnull__(1,2)));
   



 

 
extern __declspec(__nothrow) int vfscanf(FILE * __restrict  , const char * __restrict  , __va_list) __attribute__((__nonnull__(1,2)));
extern __declspec(__nothrow) int vscanf(const char * __restrict  , __va_list) __attribute__((__nonnull__(1)));
extern __declspec(__nothrow) int vsscanf(const char * __restrict  , const char * __restrict  , __va_list) __attribute__((__nonnull__(1,2)));

extern __declspec(__nothrow) int _vfscanf(FILE * __restrict  , const char * __restrict  , __va_list) __attribute__((__nonnull__(1,2)));
extern __declspec(__nothrow) int _vscanf(const char * __restrict  , __va_list) __attribute__((__nonnull__(1)));
extern __declspec(__nothrow) int _vsscanf(const char * __restrict  , const char * __restrict  , __va_list) __attribute__((__nonnull__(1,2)));

extern __declspec(__nothrow) int vprintf(const char * __restrict  , __va_list  ) __attribute__((__nonnull__(1)));
   





 
extern __declspec(__nothrow) int _vprintf(const char * __restrict  , __va_list  ) __attribute__((__nonnull__(1)));
   



 
extern __declspec(__nothrow) int vfprintf(FILE * __restrict  ,
                    const char * __restrict  , __va_list  ) __attribute__((__nonnull__(1,2)));
   






 
extern __declspec(__nothrow) int vsprintf(char * __restrict  ,
                     const char * __restrict  , __va_list  ) __attribute__((__nonnull__(1,2)));
   






 

extern __declspec(__nothrow) int vsnprintf(char * __restrict  , size_t  ,
                     const char * __restrict  , __va_list  ) __attribute__((__nonnull__(3)));
   







 

extern __declspec(__nothrow) int _vsprintf(char * __restrict  ,
                      const char * __restrict  , __va_list  ) __attribute__((__nonnull__(1,2)));
   



 
extern __declspec(__nothrow) int _vfprintf(FILE * __restrict  ,
                     const char * __restrict  , __va_list  ) __attribute__((__nonnull__(1,2)));
   



 
extern __declspec(__nothrow) int _vsnprintf(char * __restrict  , size_t  ,
                      const char * __restrict  , __va_list  ) __attribute__((__nonnull__(3)));
   



 
extern __declspec(__nothrow) int fgetc(FILE *  ) __attribute__((__nonnull__(1)));
   







 
extern __declspec(__nothrow) char *fgets(char * __restrict  , int  ,
                    FILE * __restrict  ) __attribute__((__nonnull__(1,3)));
   










 
extern __declspec(__nothrow) int fputc(int  , FILE *  ) __attribute__((__nonnull__(2)));
   







 
extern __declspec(__nothrow) int fputs(const char * __restrict  , FILE * __restrict  ) __attribute__((__nonnull__(1,2)));
   




 
extern __declspec(__nothrow) int getc(FILE *  ) __attribute__((__nonnull__(1)));
   







 




    extern __declspec(__nothrow) int (getchar)(void);

   





 
extern __declspec(__nothrow) char *gets(char *  ) __attribute__((__nonnull__(1)));
   









 
extern __declspec(__nothrow) int putc(int  , FILE *  ) __attribute__((__nonnull__(2)));
   





 




    extern __declspec(__nothrow) int (putchar)(int  );

   



 
extern __declspec(__nothrow) int puts(const char *  ) __attribute__((__nonnull__(1)));
   





 
extern __declspec(__nothrow) int ungetc(int  , FILE *  ) __attribute__((__nonnull__(2)));
   






















 

extern __declspec(__nothrow) size_t fread(void * __restrict  ,
                    size_t  , size_t  , FILE * __restrict  ) __attribute__((__nonnull__(1,4)));
   











 

extern __declspec(__nothrow) size_t __fread_bytes_avail(void * __restrict  ,
                    size_t  , FILE * __restrict  ) __attribute__((__nonnull__(1,3)));
   











 

extern __declspec(__nothrow) size_t fwrite(const void * __restrict  ,
                    size_t  , size_t  , FILE * __restrict  ) __attribute__((__nonnull__(1,4)));
   







 

extern __declspec(__nothrow) int fgetpos(FILE * __restrict  , fpos_t * __restrict  ) __attribute__((__nonnull__(1,2)));
   








 
extern __declspec(__nothrow) int fseek(FILE *  , long int  , int  ) __attribute__((__nonnull__(1)));
   














 
extern __declspec(__nothrow) int fsetpos(FILE * __restrict  , const fpos_t * __restrict  ) __attribute__((__nonnull__(1,2)));
   










 
extern __declspec(__nothrow) long int ftell(FILE *  ) __attribute__((__nonnull__(1)));
   











 
extern __declspec(__nothrow) void rewind(FILE *  ) __attribute__((__nonnull__(1)));
   





 

extern __declspec(__nothrow) void clearerr(FILE *  ) __attribute__((__nonnull__(1)));
   




 

extern __declspec(__nothrow) int feof(FILE *  ) __attribute__((__nonnull__(1)));
   


 
extern __declspec(__nothrow) int ferror(FILE *  ) __attribute__((__nonnull__(1)));
   


 
extern __declspec(__nothrow) void perror(const char *  );
   









 

extern __declspec(__nothrow) int _fisatty(FILE *   ) __attribute__((__nonnull__(1)));
    
 

extern __declspec(__nothrow) void __use_no_semihosting_swi(void);
extern __declspec(__nothrow) void __use_no_semihosting(void);
    





 











#line 948 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\stdio.h"



 

#line 12 "..\\app\\APP\\gtlib.h"
#line 1 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\time.h"
 
 
 
 









 





 













#line 41 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\time.h"


  
  typedef unsigned int size_t;








    
 
#line 65 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\time.h"





typedef unsigned int clock_t;     
typedef unsigned int time_t;      

#pragma push
#pragma anon_unions

struct tm {
    int tm_sec;   
 
    int tm_min;    
    int tm_hour;   
    int tm_mday;   
    int tm_mon;    
    int tm_year;   
    int tm_wday;   
    int tm_yday;   
    int tm_isdst;  
    union {        
        struct {
            int __extra_1, __extra_2;
        };
        struct {
            long __extra_1_long, __extra_2_long;
        };
        struct {
            char *__extra_1_cptr, *__extra_2_cptr;
        };
        struct {
            void *__extra_1_vptr, *__extra_2_vptr;
        };
    };
};

#pragma pop

   



 

extern __declspec(__nothrow) clock_t clock(void);
   





 
extern __declspec(__nothrow) double difftime(time_t  , time_t  );
   


 
extern __declspec(__nothrow) time_t mktime(struct tm *  ) __attribute__((__nonnull__(1)));
   













 
extern __declspec(__nothrow) time_t time(time_t *  );
   






 

extern __declspec(__nothrow) char *asctime(const struct tm *  ) __attribute__((__nonnull__(1)));
extern __declspec(__nothrow) char *_asctime_r(const struct tm *  ,
                                char * __restrict  ) __attribute__((__nonnull__(1,2)));

extern __declspec(__nothrow) char *asctime_r(const struct tm *  ,
                               char * __restrict  ) __attribute__((__nonnull__(1,2)));

   



 
extern __declspec(__nothrow) char *ctime(const time_t *  ) __attribute__((__nonnull__(1)));
   




 
extern __declspec(__nothrow) struct tm *gmtime(const time_t *  ) __attribute__((__nonnull__(1)));
   



 
extern __declspec(__nothrow) struct tm *localtime(const time_t *  ) __attribute__((__nonnull__(1)));
extern __declspec(__nothrow) struct tm *_localtime_r(const time_t * __restrict  ,
                                       struct tm * __restrict  ) __attribute__((__nonnull__(1,2)));

extern __declspec(__nothrow) struct tm *localtime_r(const time_t * __restrict  ,
                                      struct tm * __restrict  ) __attribute__((__nonnull__(1,2)));

   



 
extern __declspec(__nothrow) size_t strftime(char * __restrict  , size_t  ,
                       const char * __restrict  ,
                       const struct tm * __restrict  ) __attribute__((__nonnull__(1,3,4)));
   











































 











#line 272 "D:\\Keil\\ARM\\ARMCC\\bin\\..\\include\\time.h"



 

#line 13 "..\\app\\APP\\gtlib.h"
#line 1 "D:\\Keil\\ARM\\RV31\\INC\\rtl.h"









 




 

 



#line 28 "D:\\Keil\\ARM\\RV31\\INC\\rtl.h"







 typedef unsigned int   size_t;


typedef signed char     S8;
typedef unsigned char   U8;
typedef short           S16;
typedef unsigned short  U16;
typedef int             S32;
typedef unsigned int    U32;
typedef long long       S64;
typedef unsigned long long U64;
typedef unsigned char   BIT;
typedef unsigned int    BOOL;

#line 55 "D:\\Keil\\ARM\\RV31\\INC\\rtl.h"

#line 71 "D:\\Keil\\ARM\\RV31\\INC\\rtl.h"



 





 
typedef U32 OS_SEM[2];

 

typedef U32 OS_MBX[];

 
typedef U32 OS_MUT[3];

 
typedef U32 OS_TID;

 
typedef void *OS_ID;

 
typedef U32 OS_RESULT;

 












 




#line 202 "D:\\Keil\\ARM\\RV31\\INC\\rtl.h"



 



 
extern void      os_set_env    (void);
extern void      rt_sys_init   (void (*task)(void), U8 priority, void *stk);
extern void      rt_tsk_pass   (void);
extern OS_TID    rt_tsk_self   (void);
extern OS_RESULT rt_tsk_prio   (OS_TID task_id, U8 new_prio);
extern OS_TID    rt_tsk_create (void (*task)(void), U8 priority, void *stk, void *argv);
extern OS_RESULT rt_tsk_delete (OS_TID task_id);

#line 238 "D:\\Keil\\ARM\\RV31\\INC\\rtl.h"

extern void      _os_sys_init(U32 p, void (*task)(void), U32 prio_stksz,
                                     void *stk)                        __svc_indirect(0);
extern OS_TID    _os_tsk_create (U32 p, void (*task)(void), U32 prio_stksz,
                                        void *stk, void *argv)         __svc_indirect(0);
extern OS_TID    _os_tsk_create_ex (U32 p, void (*task)(void *), U32 prio_stksz,
                                           void *stk, void *argv)      __svc_indirect(0);
extern OS_TID    _os_tsk_self (U32 p)                                  __svc_indirect(0);
extern void      _os_tsk_pass (U32 p)                                  __svc_indirect(0);
extern OS_RESULT _os_tsk_prio (U32 p, OS_TID task_id, U8 new_prio)     __svc_indirect(0);
extern OS_RESULT _os_tsk_delete (U32 p, OS_TID task_id)                __svc_indirect(0);

 
extern OS_RESULT rt_evt_wait (U16 wait_flags,  U16 timeout, BOOL and_wait);
extern void      rt_evt_set  (U16 event_flags, OS_TID task_id);
extern void      rt_evt_clr  (U16 clear_flags, OS_TID task_id);
extern U16       rt_evt_get  (void);







extern OS_RESULT _os_evt_wait(U32 p, U16 wait_flags, U16 timeout,
                                     BOOL and_wait)                    __svc_indirect(0);
extern void      _os_evt_set (U32 p, U16 event_flags, OS_TID task_id)  __svc_indirect(0);
extern void      _os_evt_clr (U32 p, U16 clear_flags, OS_TID task_id)  __svc_indirect(0);
extern U16       _os_evt_get (U32 p)                                   __svc_indirect(0);
extern void      isr_evt_set (U16 event_flags, OS_TID task_id);

 
extern void      rt_sem_init (OS_ID semaphore, U16 token_count);
extern OS_RESULT rt_sem_send (OS_ID semaphore);
extern OS_RESULT rt_sem_wait (OS_ID semaphore, U16 timeout);





extern void      _os_sem_init (U32 p, OS_ID semaphore, 
                                      U16 token_count)                 __svc_indirect(0);
extern OS_RESULT _os_sem_send (U32 p, OS_ID semaphore)                 __svc_indirect(0);
extern OS_RESULT _os_sem_wait (U32 p, OS_ID semaphore, U16 timeout)    __svc_indirect(0);
extern void      isr_sem_send (OS_ID semaphore);

 
extern void      rt_mbx_init  (OS_ID mailbox, U16 mbx_size);
extern OS_RESULT rt_mbx_send  (OS_ID mailbox, void *p_msg,    U16 timeout);
extern OS_RESULT rt_mbx_wait  (OS_ID mailbox, void **message, U16 timeout);
extern OS_RESULT rt_mbx_check (OS_ID mailbox);







extern void      _os_mbx_init (U32 p, OS_ID mailbox, U16 mbx_size)     __svc_indirect(0);
extern OS_RESULT _os_mbx_send (U32 p, OS_ID mailbox, void *message_ptr,
                                      U16 timeout)                     __svc_indirect(0);
extern OS_RESULT _os_mbx_wait (U32 p, OS_ID mailbox, void  **message,
                                      U16 timeout)                     __svc_indirect(0);
extern OS_RESULT _os_mbx_check (U32 p, OS_ID mailbox)                  __svc_indirect(0);
extern void      isr_mbx_send (OS_ID mailbox, void *message_ptr);
extern OS_RESULT isr_mbx_receive (OS_ID mailbox, void **message);

 
extern void      rt_mut_init    (OS_ID mutex);
extern OS_RESULT rt_mut_release (OS_ID mutex);
extern OS_RESULT rt_mut_wait    (OS_ID mutex, U16 timeout);





extern void      _os_mut_init (U32 p, OS_ID mutex)                     __svc_indirect(0);
extern OS_RESULT _os_mut_release (U32 p, OS_ID mutex)                  __svc_indirect(0);
extern OS_RESULT _os_mut_wait (U32 p, OS_ID mutex, U16 timeout)        __svc_indirect(0);

 
extern U32       rt_time_get (void);
extern void      rt_dly_wait (U16 delay_time);
extern void      rt_itv_set  (U16 interval_time);
extern void      rt_itv_wait (void);






extern U32       _os_time_get (U32 p)                                  __svc_indirect(0);
extern void      _os_dly_wait (U32 p, U16 delay_time)                  __svc_indirect(0);
extern void      _os_itv_set (U32 p, U16 interval_time)                __svc_indirect(0);
extern void      _os_itv_wait (U32 p)                                  __svc_indirect(0);

 
extern OS_ID     rt_tmr_create (U16 tcnt, U16 info);
extern OS_ID     rt_tmr_kill   (OS_ID timer);




extern OS_ID     _os_tmr_create (U32 p, U16 tcnt, U16 info)            __svc_indirect(0);
extern OS_ID     _os_tmr_kill (U32 p, OS_ID timer)                     __svc_indirect(0);

 
extern U32       rt_suspend    (void);
extern void      rt_resume     (U32 sleep_time);
extern void      rt_tsk_lock   (void);
extern void      rt_tsk_unlock (void);






extern U32       _os_suspend (U32 p)                                   __svc_indirect(0);
extern void      _os_resume (U32 p, U32 sleep_time)                    __svc_indirect(0);
extern void      _os_tsk_lock (U32 p)                                  __svc_indirect(0);
extern void      _os_tsk_unlock (U32 p)                                __svc_indirect(0);

 
extern int       _init_box (void *box_mem, U32 box_size, U32 blk_size);
extern void     *_alloc_box (void *box_mem);
extern void     *_calloc_box (void *box_mem);
extern int       _free_box (void *box_mem, void *box);








 




 

typedef struct {                         
  U8  hr;                                
  U8  min;                               
  U8  sec;                               
  U8  day;                               
  U8  mon;                               
  U16 year;                              
} RL_TIME;

typedef struct {                         
  S8  name[256];                         
  U32 size;                              
  U16 fileID;                            
  U8  attrib;                            
  RL_TIME time;                          
} FINFO;

extern int finit (const char *drive);
extern int funinit (const char *drive);
extern int fdelete (const char *filename);
extern int frename (const char *oldname, const char *newname);
extern int ffind (const char *pattern, FINFO *info);
extern U64 ffree (const char *drive);
extern int fformat (const char *drive);
extern int fanalyse (const char *drive);
extern int fcheck (const char *drive);
extern int fdefrag (const char *drive);
extern int fattrib (const char *par, const char *path);
extern int fvol    (const char *drive, char *buf);

 




 

 



 
#line 428 "D:\\Keil\\ARM\\RV31\\INC\\rtl.h"

 
#line 436 "D:\\Keil\\ARM\\RV31\\INC\\rtl.h"

 
#line 449 "D:\\Keil\\ARM\\RV31\\INC\\rtl.h"

 




 




 



 



 



 
#line 484 "D:\\Keil\\ARM\\RV31\\INC\\rtl.h"

 



 





 



 





 
#line 512 "D:\\Keil\\ARM\\RV31\\INC\\rtl.h"

 




 
#line 527 "D:\\Keil\\ARM\\RV31\\INC\\rtl.h"

 
#line 537 "D:\\Keil\\ARM\\RV31\\INC\\rtl.h"

 
#line 545 "D:\\Keil\\ARM\\RV31\\INC\\rtl.h"

 



 
typedef struct sockaddr {          
  U16  sa_family;                  
  char sa_data[14];                
} SOCKADDR;

#pragma push
#pragma anon_unions

typedef struct in_addr {           
  union {
    struct {
      U8 s_b1,s_b2,s_b3,s_b4;      
    };
    struct {
      U16 s_w1,s_w2;               
    };
    U32 s_addr;                    
  };
} IN_ADDR;
#pragma pop

typedef struct sockaddr_in {       
  S16 sin_family;                  
  U16 sin_port;                    
  IN_ADDR sin_addr;                
  S8  sin_zero[8];                 
} SOCKADDR_IN;

typedef struct hostent {           
  char *h_name;                    
  char **h_aliases;                
  S16  h_addrtype;                 
  S16  h_length;                   
  char **h_addr_list;              
} HOSTENT;

extern void init_TcpNet (void);
extern BOOL main_TcpNet (void);
extern void timer_tick (void);
extern U8   udp_get_socket (U8 tos, U8 opt, 
                            U16 (*listener)(U8 socket, U8 *remip, U16 port, U8 *buf, U16 len));
extern BOOL udp_release_socket (U8 socket);
extern BOOL udp_open (U8 socket, U16 locport);
extern BOOL udp_close (U8 socket);
extern BOOL udp_mcast_ttl (U8 socket, U8 ttl);
extern U8  *udp_get_buf (U16 size);
extern BOOL udp_send (U8 socket, U8 *remip, U16 remport, U8 *buf, U16 dlen);
extern U8   tcp_get_socket (U8 type, U8 tos, U16 tout,
                            U16 (*listener)(U8 socket, U8 event, U8 *buf, U16 len));
extern BOOL tcp_release_socket (U8 socket);
extern BOOL tcp_listen (U8 socket, U16 locport);
extern BOOL tcp_connect (U8 socket, U8 *remip, U16 remport, U16 locport);
extern U8  *tcp_get_buf (U16 size);
extern U16  tcp_max_dsize (U8 socket);
extern BOOL tcp_check_send (U8 socket);
extern U8   tcp_get_state (U8 socket);
extern BOOL tcp_send (U8 socket, U8 *buf, U16 dlen);
extern BOOL tcp_close (U8 socket);
extern BOOL tcp_abort (U8 socket);
extern void tcp_reset_window (U8 socket);
extern BOOL arp_cache_ip (U8 *ipadr, U8 type);
extern BOOL arp_cache_mac (U8 *hwadr);
extern void ppp_listen (const char *user, const char *passw);
extern void ppp_connect (const char *dialnum, const char *user, const char *passw);
extern void ppp_close (void);
extern BOOL ppp_is_up (void);
extern void slip_listen (void);
extern void slip_connect (const char *dialnum);
extern void slip_close (void);
extern BOOL slip_is_up (void);
extern U8   get_host_by_name (U8 *hostn, void (*cbfunc)(U8 event, U8 *host_ip));
extern BOOL smtp_connect (U8 *ipadr, U16 port, void (*cbfunc)(U8 event));
extern void dhcp_disable (void);
extern BOOL igmp_join (U8 *group_ip);
extern BOOL igmp_leave (U8 *group_ip);
extern BOOL snmp_trap (U8 *manager_ip, U8 gen_trap, U8 spec_trap, U16 *obj_list);
extern BOOL snmp_set_community (const char *community);
extern BOOL icmp_ping (U8 *remip, void (*cbfunc)(U8 event));
extern BOOL ftpc_connect (U8 *ipadr, U16 port, U8 command, void (*cbfunc)(U8 event));
extern BOOL tftpc_put (U8 *ipadr, U16 port,
                       const char *src, const char *dst, void (*cbfunc)(U8 event));
extern BOOL tftpc_get (U8 *ipadr, U16 port, 
                       const char *src, const char *dst, void (*cbfunc)(U8 event));
extern BOOL sntp_get_time (U8 *ipadr, void (*cbfunc)(U32 utc_time));

 
extern int  socket (int family, int type, int protocol);
extern int  bind (int sock, const SOCKADDR *addr, int addrlen);
extern int  listen (int sock, int backlog);
extern int  accept (int sock, SOCKADDR *addr, int *addrlen);
extern int  connect (int sock, SOCKADDR *addr, int addrlen);
extern int  send (int sock, const char *buf, int len, int flags);
extern int  sendto (int sock, const char *buf, int len, int flags, SOCKADDR *to, int tolen);
extern int  recv (int sock, char *buf, int len, int flags);
extern int  recvfrom (int sock, char *buf, int len, int flags, SOCKADDR *from, int *fromlen);
extern int  closesocket (int sock);
extern int  getpeername (int sock, SOCKADDR *name, int *namelen);
extern int  getsockname (int sock, SOCKADDR *name, int *namelen);
extern int  ioctlsocket (int sock, long cmd, unsigned long *argp);
extern HOSTENT *gethostbyname (const char *name, int *err);







 


 
#line 14 "..\\app\\APP\\gtlib.h"
#line 1 "..\\config\\Net_Config.h"









 




#line 16 "..\\config\\Net_Config.h"

 



                                   






 






 




 
#line 53 "..\\config\\Net_Config.h"

 





 
#line 84 "..\\config\\Net_Config.h"

 





typedef struct os_frame {          
  U16 length;                      
  U16 index;                       
  U8  data[1];                     
} OS_FRAME;

typedef struct arp_info {          
  U8  State;                       
  U8  Type;                        
  U8  Retries;                     
  U8  Tout;                        
  U8  HwAdr[6];           
  U8  IpAdr[4];            
} ARP_INFO;

typedef struct igmp_info {         
  U8  State;                       
  U8  Tout;                        
  U8  Flags;                       
  U8  GrpIpAdr[4];         
} IGMP_INFO;

typedef struct udp_info {          
  U8  State;                       
  U8  Opt;                         
  U8  Flags;                       
  U8  Tos;                         
  U16 LocPort;                     
  U8  McastTtl;                    
                                   
  U16 (*cb_func)(U8 socket, U8 *rem_ip, U16 port, U8 *buf, U16 len);
} UDP_INFO;

typedef struct tcp_info {          
  U8  State;                       
  U8  Type;                        
  U8  Flags;                       
  U8  Tos;                         
  U8  RemIpAdr[4];         
  U16 RemPort;                     
  U16 LocPort;                     
  U16 MaxSegSize;                  
  U16 Tout;                        
  U16 AliveTimer;                  
  U16 RetryTimer;                  
  U8  AckTimer;                    
  U8  Id;                          
  U8  Retries;                     
  U8  DupAcks;                     
  U32 SendUna;                     
  U32 SendNext;                    
  U32 SendChk;                     
  U32 SendWl1;                     
  U32 SendWl2;                     
  U16 SendWin;                     
  S16 RttSa;                       
  S16 RttSv;                       
  U16 CWnd;                        
  U16 SsThresh;                    
  U16 RecWin;                      
  U32 RecNext;                     
  OS_FRAME *unack_list;            
                                   
  U16 (*cb_func)(U8 socket, U8 event, U8 *p1, U16 p2);
} TCP_INFO;

typedef struct bsd_info {          
  U8  State;                       
  U8  Socket;                      
  U8  Flags;                       
  U8  Type;                        
  U16 LocPort;                     
  U16 RemPort;                     
  U32 LocIP;                       
  U32 RemIP;                       
  U8  AcceptSock;                  
  U8  ParentSock;                  
  U8  Event;                       
  U8  Task;                        
  U16 Tout;                        
  void *buf_list;                  
} BSD_INFO;

typedef struct http_info {         
  U8  State;                       
  U8  Socket;                      
  U16 Flags;                       
  U8  FType;                       
  U8  PostSt;                      
  U16 DelimSz;                     
  U8  UserId;                      
  U32 CGIvar;                      
  U32 DLen;                        
  U32 Count;                       
  U16 BCnt;                        
  U8  Lang[6];                     
  U32 LMDate;                      
  U8 *Script;                      
  U8 *pDelim;                      
  void *sFile;                     
  void *dFile;                     
} HTTP_INFO;

typedef struct http_file {         
  U32       Id;                    
  const U8 *Start;                 
} const HTTP_FILE;

typedef struct tnet_info {         
  U8  State;                       
  U8  Socket;                      
  U8  Flags;                       
  U8  BCnt;                        
  U16 Tout;                        
  U8  UserId;                      
  U8  Widx;                        
  U8  Ridx;                        
  U8  hNext;                       
  U8  hCurr;                       
  U32 SVar;                        
  U8  LBuf[96];           
  U8  Fifo[128];           
  U8  Hist[128];           
} TNET_INFO;

typedef struct tftp_info {         
  U8  State;                       
  U8  Socket;                      
  U8  Flags;                       
  U8  Retries;                     
  U8  RemIpAdr[4];         
  U16 RemPort;                     
  U16 BlockSz;                     
  U16 BlockNr;                     
  U8  Timer;                       
  U16 BufLen;                      
  U8  *Buf;                        
  void *File;                      
} TFTP_INFO;

typedef struct ftp_info {          
  U8  State;                       
  U8  Socket;                      
  U16 Flags;                       
  U8  RemIpAdr[4];         
  U16 DPort;                       
  U8  DSocket;                     
  U8  UserId;                      
  U8  Resp;                        
  U8  PathLen;                     
  U8 *Path;                        
  U8 *Name;                        
  void *File;                      
} FTP_INFO;

typedef struct dns_cache {         
  U32 HostId;                      
  U32 Ttl;                         
  U8  IpAdr[4];            
} DNS_CACHE;

typedef struct localm {            
  U8  IpAdr[4];            
  U8  DefGW[4];            
  U8  NetMask[4];          
  U8  PriDNS[4];           
  U8  SecDNS[4];           
} LOCALM;

typedef struct remotem {           
  U8  IpAdr[4];            
  U8  HwAdr[6];           
} REMOTEM;

typedef struct mib_entry {         
  U8  Type;                        
  U8  OidLen;                      
  U8  Oid[17];              
  U8  ValSz;                       
  void *Val;                       
  void (*cb_func)(int mode);       
} MIB_ENTRY;

typedef struct sys_cfg {           
  U32 *MemPool;                    
  U32 MemSize;                     
  U8  TickRate;                    
  U8  TickItv;                     
  U8  T200ms;                      
  U8  NetCfg;                      
  U8 *HostName;                    
} const SYS_CFG;

typedef struct arp_cfg {           
  ARP_INFO *Table;                 
  U8  TabSize;                     
  U8  TimeOut;                     
  U8  MaxRetry;                    
  U8  Resend;                      
  U8  Notify;                      
} const ARP_CFG;

typedef struct igmp_cfg {          
  IGMP_INFO *Table;                
  U16 TabSize;                     
} const IGMP_CFG;

typedef struct dhcp_cfg {          
  U8 *Vcid;                        
  U8  Opt;                         
} const DHCP_CFG;

typedef struct ppp_cfg {           
  U32 ACCmap;                      
  U16 SerTout;                     
  U16 RetryTout;                   
  U16 EchoTout;                    
  U8  MaxRetry;                    
  U8  EnAuth;                      
} const PPP_CFG;

typedef struct udp_cfg {           
  UDP_INFO *Scb;                   
  U8  NumSocks;                    
} const UDP_CFG;

typedef struct tcp_cfg {           
  TCP_INFO *Scb;                   
  U8  NumSocks;                    
  U8  MaxRetry;                    
  U16 RetryTout;                   
  U16 T2MSLTout;                   
  U16 SynRetryTout;                
  U16 InitRetryTout;               
  U16 DefTout;                     
  U16 MaxSegSize;                  
  U16 RecWinSize;                  
  U8  ConRetry;                    
} const TCP_CFG;

typedef struct http_cfg {          
  HTTP_INFO *Scb;                  
  U8  NumSess;                     
  U8  EnAuth;                      
  U16 PortNum;                     
  U8 const *SrvId;                 
  U8 const *Realm;                 
  U8 const *User;                  
  U8 *Passw;                       
} const HTTP_CFG;

typedef struct tnet_cfg {          
  TNET_INFO *Scb;                  
  U8  NumSess;                     
  U8  EnAuth;                      
  U8  NoEcho;                      
  U16 PortNum;                     
  U16 IdleTout;                    
  U8 const *User;                  
  U8 *Passw;                       
} const TNET_CFG;

typedef struct tftp_cfg {          
  TFTP_INFO *Scb;                  
  U8  NumSess;                     
  U8  MaxRetry;                    
  U16 PortNum;                     
  U8  DefTout;                     
  U8  EnFwall;                     
} const TFTP_CFG;

typedef struct tftpc_cfg {         
  U16 BlockSize;                   
  U16 RetryTout;                   
  U8  MaxRetry;                    
} const TFTPC_CFG;

typedef struct ftp_cfg {           
  FTP_INFO *Scb;                   
  U8  NumSess;                     
  U8  EnAuth;                      
  U16 PortNum;                     
  U16 IdleTout;                    
  U8  MsgLen;                      
  U8 const *Msg;                    
  U8 const *User;                  
  U8 *Passw;                       
} const FTP_CFG;

typedef struct ftpc_cfg {          
  U8  DefTout;                     
  U8  PasvMode;                    
} const FTPC_CFG;

typedef struct dns_cfg {           
  DNS_CACHE *Table;                
  U8  TabSize;                     
} const DNS_CFG;

typedef struct snmp_cfg {          
  U16 PortNum;                     
  U16 TrapPort;                    
  U8  TrapIp[4];           
  U8 const *Community;             
  U8  TickItv;                     
} const SNMP_CFG;

typedef struct sntp_cfg {          
  U8  SrvIp[4];            
  U8  Bcast;                       
} const SNTP_CFG;

typedef struct bsd_cfg {           
  BSD_INFO *Scb;                   
  U8  NumSocks;                    
  U8  InRtx;                       
  U16 RcvTout;                     
} const BSD_CFG;

typedef enum {                     
  ERR_MEM_ALLOC,                   
  ERR_MEM_FREE,                    
  ERR_MEM_CORRUPT,                 
  ERR_MEM_LOCK,                    
  ERR_UDP_ALLOC,                   
  ERR_TCP_ALLOC,                   
  ERR_TCP_STATE                    
} ERROR_CODE;




 

 
extern void init_system (void);
extern void run_system (void);
extern void sys_error (ERROR_CODE code);

 
extern OS_FRAME *alloc_mem (U32 byte_size);
extern void free_mem (OS_FRAME *mem_ptr);

 
extern void eth_init_link (void);
extern void eth_run_link (void);
extern void put_in_queue (OS_FRAME *frame);
extern BOOL eth_send_frame (OS_FRAME *frame);
extern BOOL eth_chk_adr (OS_FRAME *frame);
extern U8  *eth_get_adr (U8 *ipadr);

 
extern void ppp_init_link (void);
extern void ppp_run_link (void);
extern BOOL ppp_send_frame (OS_FRAME *frame, U16 prot);

 
extern void pap_init (void);
extern void pap_process (OS_FRAME *frame);
extern void pap_run (void);

 
extern void chap_init (void);
extern void chap_process (OS_FRAME *frame);
extern void chap_run (void);

 
extern void slip_init_link (void);
extern void slip_run_link (void);
extern BOOL slip_send_frame (OS_FRAME *frame);

 
extern int  mem_copy (void *dp, void *sp, int len);
extern void mem_rcopy (void *dp, void *sp, int len);
extern BOOL mem_comp (void *sp1, void *sp2, int len);
extern void mem_set (void *dp, U8 val, int len);
extern BOOL mem_test (void *sp, U8 val, int len);
extern BOOL str_scomp (U8 *sp, U8 const *cp);
extern int  str_copy (U8 *dp, U8 *sp);
extern void str_up_case (U8 *dp, U8 *sp);

 
extern void arp_notify (void);
extern BOOL arp_get_info (REMOTEM *info);

 
extern void ip_init (void);
extern void ip_run_local (void);

 
extern void dhcp_cbfunc (U8 opt, U8 *val);

 
extern void icmp_init (void);
extern void icmp_run_engine (void);

 
extern void igmp_init (void);
extern void igmp_run_host (void);
extern void igmp_process (OS_FRAME *frame);

 
extern void udp_init (void);
extern void udp_process (OS_FRAME *frame);

 
extern void tcp_init (void);
extern void tcp_poll_sockets (void);
extern void tcp_process (OS_FRAME *frame);

 
extern void bsd_init (void);
extern void bsd_poll_sockets (void);
extern U8   bsd_wait (BSD_INFO *bsd_s, U8 evt);
extern void bsd_enable (BSD_INFO *bsd_s, U8 evt);

 
extern void bsd_init_host (void);

 
extern void http_init (void);
extern void http_run_server (void);
extern void *http_fopen (U8 *name);
extern void http_fclose (void *file);
extern U16  http_fread (void *file, U8 *buf, U16 len);
extern BOOL http_fgets (void *file, U8 *buf, U16 size);
extern U32  http_finfo (U8 *name);
extern void cgi_process_var (U8 *qstr);
extern void cgi_process_data (U8 code, U8 *dat, U16 len);
extern U16  cgi_func (U8 *env, U8 *buf, U16 buflen, U32 *pcgi);
extern U8  *cgx_content_type (void);
extern BOOL http_accept_host (U8 *rem_ip, U16 rem_port);
extern BOOL http_file_access (U8 *fname, U8 user_id);
extern U8   http_check_account (U8 *user, U8 *passw);
extern U8  *http_get_var (U8 *env, void *ansi, U16 maxlen);
extern U8  *http_get_lang (void);
extern void http_get_info (REMOTEM *info);
extern U8   http_get_session (void);
extern U8   http_get_user_id (void);
extern U8  *http_get_content_type (void);
extern U32  http_date (RL_TIME *time);

 
extern void tnet_init (void);
extern void tnet_run_server (void);
extern U16  tnet_cbfunc (U8 code, U8 *buf, U16 buflen);
extern U16  tnet_process_cmd (U8 *cmd, U8 *buf, U16 buflen, U32 *pvar);
extern BOOL tnet_ccmp (U8 *buf, U8 *cmd);
extern void tnet_set_delay (U16 cnt);
extern void tnet_get_info (REMOTEM *info);
extern U8   tnet_get_session (void);
extern U8   tnet_get_user_id (void);
extern BOOL tnet_msg_poll (U8 session);
extern BOOL tnet_accept_host (U8 *rem_ip, U16 rem_port);
extern U8   tnet_check_account (U8 code, U8 *id);

 
extern void tftp_init (void);
extern void tftp_run_server (void);
extern void *tftp_fopen (U8 *fname, U8 *mode);
extern void tftp_fclose (void *file);
extern U16  tftp_fread (void *file, U8 *buf, U16 len);
extern U16  tftp_fwrite (void *file, U8 *buf, U16 len);
extern BOOL tftp_accept_host (U8 *rem_ip, U16 rem_port);

 
extern void tftpc_init (void);
extern void tftpc_run_client (void);
extern void *tftpc_fopen (U8 *fname, U8 *mode);
extern void tftpc_fclose (void *file);
extern U16  tftpc_fread (void *file, U8 *buf, U16 len);
extern U16  tftpc_fwrite (void *file, U8 *buf, U16 len);

 
extern void ftp_init (void);
extern void ftp_run_server (void);
extern void *ftp_fopen (U8 *fname, U8 *mode);
extern void ftp_fclose (void *file);
extern U16  ftp_fread (void *file, U8 *buf, U16 len);
extern U16  ftp_fwrite (void *file, U8 *buf, U16 len);
extern BOOL ftp_fdelete (U8 *fname);
extern BOOL ftp_frename (U8 *fname, U8 *newn);
extern U16  ftp_ffind (U8 code, U8 *buf, U8 *mask, U16 len);
extern BOOL ftp_accept_host (U8 *rem_ip, U16 rem_port);
extern U8   ftp_check_account (U8 code, U8 *id);
extern U8   ftp_get_user_id (void);
extern BOOL ftp_file_access (U8 *fname, U8 mode, U8 user_id);

 
extern void ftpc_init (void);
extern void ftpc_run_client (void);
extern void *ftpc_fopen (U8 *mode);
extern void ftpc_fclose (void *file);
extern U16  ftpc_fread (void *file, U8 *buf, U16 len);
extern U16  ftpc_fwrite (void *file, U8 *buf, U16 len);
extern U16  ftpc_cbfunc (U8 code, U8 *buf, U16 buflen);

 
extern void dhcp_init (void);
extern void dhcp_run_client (void);


 
extern void nbns_init (void);

 
extern void dns_init (void);
extern void dns_run_client (void);
extern U8   get_host_by_name (U8 *hostn, void (*cbfunc)(U8, U8 *));

 
extern void smtp_init (void);
extern void smtp_run_client (void);
extern U16  smtp_cbfunc (U8 code, U8 *buf, U16 buflen, U32 *pvar);
extern BOOL smtp_accept_auth (U8 *srv_ip);

 
extern void snmp_init (void);
extern void snmp_run_agent (void);

 
extern void sntp_init (void);
extern void sntp_run_client (void);

 
extern void init_ethernet (void);
extern void send_frame (OS_FRAME *frame);
__weak void poll_ethernet (void);
extern void int_enable_eth (void);
extern void int_disable_eth (void);

 
extern void init_serial (void);
extern int  com_getchar (void);
extern BOOL com_putchar (U8 c);
extern BOOL com_tx_active (void);

 
extern void modem_init (void);
extern void modem_dial (U8 *dialnum);
extern void modem_hangup (void);
extern void modem_listen (void);
extern BOOL modem_online (void);
extern BOOL modem_process (U8 ch);
extern void modem_run (void);







 



#line 15 "..\\app\\APP\\gtlib.h"

typedef unsigned char   uint8;
typedef unsigned short  uint16;
typedef unsigned int    uint32;
typedef unsigned long long uint64;

typedef unsigned char   U8;
typedef unsigned short  U16;
typedef unsigned int    U32;
typedef unsigned long long U64;

typedef unsigned char BYTE;



void bitSet(uint32* dat,int pos);
void bitClr(uint32* dat,int pos);
int	 bitTest(uint32* dat,int pos);
int  bitCnt(uint32* dat,int len);



U16 CHECK_CRC(const U8 *p,U16 n);
uint16 calc_crc(uint8 dat,uint16 crc);

U16 cs16(const U8 *p, U32 nLength);
U8 cs8(const U8 *p, U32 nLength);



void   memreverse(uint8* pBuf,int size); 
uint8  bcd2bin8 (uint8  x);
uint8  bin2bcd8 (uint8  x);
uint16 bin2bcd16(uint16 x);
uint16 bcd2bin16(uint16 x);
uint32 bin2bcd32(uint32 x);
uint32 bcd2bin32(uint32 x);
uint64 bin2bcd64(uint64 x);
uint64 bcd2bin64(uint64 x);





































int set_time(unsigned int t);
int set_time_bcd(unsigned char *Bcd6Time);
void time2bcd(time_t t,U8 * btime);
time_t bcd2time(U8 * bTime,U8 n);
int dif_time(U8 *btime,U8 type);
int ot_time(U8 type,int dif);
int next_time_bcd(U8 *next, U8 *cur,U8 type);

extern void Sleep(int ms);

extern uint32 debugMark;

#line 111 "..\\app\\APP\\gtlib.h"












 
#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"














 

 



 
#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_map.h"














 

 







 
#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_conf.h"













 

 



 
#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_type.h"














 

 



 
 
typedef signed long  s32;
typedef signed short s16;
typedef signed char  s8;

typedef signed long  const sc32;   
typedef signed short const sc16;   
typedef signed char  const sc8;    

typedef volatile signed long  vs32;
typedef volatile signed short vs16;
typedef volatile signed char  vs8;

typedef volatile signed long  const vsc32;   
typedef volatile signed short const vsc16;   
typedef volatile signed char  const vsc8;    

typedef unsigned long  u32;
typedef unsigned short u16;
typedef unsigned char  u8;

typedef unsigned long  const uc32;   
typedef unsigned short const uc16;   
typedef unsigned char  const uc8;    

typedef volatile unsigned long  vu32;
typedef volatile unsigned short vu16;
typedef volatile unsigned char  vu8;

typedef volatile unsigned long  const vuc32;   
typedef volatile unsigned short const vuc16;   
typedef volatile unsigned char  const vuc8;    



typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus;

typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;


typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus;

#line 73 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_type.h"

 
 
 



 
#line 22 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_conf.h"

 
 


 
 

 
 





 


 


 


 


 


 
#line 66 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_conf.h"

 


 



 


 


 
#line 90 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_conf.h"

 




 


 


 


 


 


 


 





 


 
#line 133 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_conf.h"

 
#line 141 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_conf.h"

 



 


 
#line 167 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_conf.h"



 
#line 27 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_map.h"
#line 28 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_map.h"
#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\cortexm3_macro.h"













 

 



 
#line 22 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\cortexm3_macro.h"

 
 
 
 
void __WFI(void);
void __WFE(void);
void __SEV(void);
void __ISB(void);
void __DSB(void);
void __DMB(void);
void __SVC(void);
u32 __MRS_CONTROL(void);
void __MSR_CONTROL(u32 Control);
u32 __MRS_PSP(void);
void __MSR_PSP(u32 TopOfProcessStack);
u32 __MRS_MSP(void);
void __MSR_MSP(u32 TopOfMainStack);
void __RESETPRIMASK(void);
void __SETPRIMASK(void);
u32 __READ_PRIMASK(void);
void __RESETFAULTMASK(void);
void __SETFAULTMASK(void);
u32 __READ_FAULTMASK(void);
void __BASEPRICONFIG(u32 NewPriority);
u32 __GetBASEPRI(void);
u16 __REV_HalfWord(u16 Data);
u32 __REV_Word(u32 Data);



 
#line 29 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_map.h"

 
 
 
 

 
typedef struct
{
  vu32 SR;
  vu32 CR1;
  vu32 CR2;
  vu32 SMPR1;
  vu32 SMPR2;
  vu32 JOFR1;
  vu32 JOFR2;
  vu32 JOFR3;
  vu32 JOFR4;
  vu32 HTR;
  vu32 LTR;
  vu32 SQR1;
  vu32 SQR2;
  vu32 SQR3;
  vu32 JSQR;
  vu32 JDR1;
  vu32 JDR2;
  vu32 JDR3;
  vu32 JDR4;
  vu32 DR;
} ADC_TypeDef;

 
typedef struct
{
  u32  RESERVED0;
  vu16 DR1;
  u16  RESERVED1;
  vu16 DR2;
  u16  RESERVED2;
  vu16 DR3;
  u16  RESERVED3;
  vu16 DR4;
  u16  RESERVED4;
  vu16 DR5;
  u16  RESERVED5;
  vu16 DR6;
  u16  RESERVED6;
  vu16 DR7;
  u16  RESERVED7;
  vu16 DR8;
  u16  RESERVED8;
  vu16 DR9;
  u16  RESERVED9;
  vu16 DR10;
  u16  RESERVED10; 
  vu16 RTCCR;
  u16  RESERVED11;
  vu16 CR;
  u16  RESERVED12;
  vu16 CSR;
  u16  RESERVED13[5];
  vu16 DR11;
  u16  RESERVED14;
  vu16 DR12;
  u16  RESERVED15;
  vu16 DR13;
  u16  RESERVED16;
  vu16 DR14;
  u16  RESERVED17;
  vu16 DR15;
  u16  RESERVED18;
  vu16 DR16;
  u16  RESERVED19;
  vu16 DR17;
  u16  RESERVED20;
  vu16 DR18;
  u16  RESERVED21;
  vu16 DR19;
  u16  RESERVED22;
  vu16 DR20;
  u16  RESERVED23;
  vu16 DR21;
  u16  RESERVED24;
  vu16 DR22;
  u16  RESERVED25;
  vu16 DR23;
  u16  RESERVED26;
  vu16 DR24;
  u16  RESERVED27;
  vu16 DR25;
  u16  RESERVED28;
  vu16 DR26;
  u16  RESERVED29;
  vu16 DR27;
  u16  RESERVED30;
  vu16 DR28;
  u16  RESERVED31;
  vu16 DR29;
  u16  RESERVED32;
  vu16 DR30;
  u16  RESERVED33; 
  vu16 DR31;
  u16  RESERVED34;
  vu16 DR32;
  u16  RESERVED35;
  vu16 DR33;
  u16  RESERVED36;
  vu16 DR34;
  u16  RESERVED37;
  vu16 DR35;
  u16  RESERVED38;
  vu16 DR36;
  u16  RESERVED39;
  vu16 DR37;
  u16  RESERVED40;
  vu16 DR38;
  u16  RESERVED41;
  vu16 DR39;
  u16  RESERVED42;
  vu16 DR40;
  u16  RESERVED43;
  vu16 DR41;
  u16  RESERVED44;
  vu16 DR42;
  u16  RESERVED45;    
} BKP_TypeDef;

 
typedef struct
{
  vu32 TIR;
  vu32 TDTR;
  vu32 TDLR;
  vu32 TDHR;
} CAN_TxMailBox_TypeDef;

typedef struct
{
  vu32 RIR;
  vu32 RDTR;
  vu32 RDLR;
  vu32 RDHR;
} CAN_FIFOMailBox_TypeDef;

typedef struct
{
  vu32 FR1;
  vu32 FR2;
} CAN_FilterRegister_TypeDef;

typedef struct
{
  vu32 MCR;
  vu32 MSR;
  vu32 TSR;
  vu32 RF0R;
  vu32 RF1R;
  vu32 IER;
  vu32 ESR;
  vu32 BTR;
  u32  RESERVED0[88];
  CAN_TxMailBox_TypeDef sTxMailBox[3];
  CAN_FIFOMailBox_TypeDef sFIFOMailBox[2];
  u32  RESERVED1[12];
  vu32 FMR;
  vu32 FM1R;
  u32  RESERVED2;
  vu32 FS1R;
  u32  RESERVED3;
  vu32 FFA1R;
  u32  RESERVED4;
  vu32 FA1R;
  u32  RESERVED5[8];
  CAN_FilterRegister_TypeDef sFilterRegister[14];
} CAN_TypeDef;

 
typedef struct
{
  vu32 DR;
  vu8  IDR;
  u8   RESERVED0;
  u16  RESERVED1;
  vu32 CR;
} CRC_TypeDef;


 
typedef struct
{
  vu32 CR;
  vu32 SWTRIGR;
  vu32 DHR12R1;
  vu32 DHR12L1;
  vu32 DHR8R1;
  vu32 DHR12R2;
  vu32 DHR12L2;
  vu32 DHR8R2;
  vu32 DHR12RD;
  vu32 DHR12LD;
  vu32 DHR8RD;
  vu32 DOR1;
  vu32 DOR2;
} DAC_TypeDef;

 
typedef struct
{
  vu32 IDCODE;
  vu32 CR;	
}DBGMCU_TypeDef;

 
typedef struct
{
  vu32 CCR;
  vu32 CNDTR;
  vu32 CPAR;
  vu32 CMAR;
} DMA_Channel_TypeDef;

typedef struct
{
  vu32 ISR;
  vu32 IFCR;
} DMA_TypeDef;

 
typedef struct
{
  vu32 IMR;
  vu32 EMR;
  vu32 RTSR;
  vu32 FTSR;
  vu32 SWIER;
  vu32 PR;
} EXTI_TypeDef;

 
typedef struct
{
  vu32 ACR;
  vu32 KEYR;
  vu32 OPTKEYR;
  vu32 SR;
  vu32 CR;
  vu32 AR;
  vu32 RESERVED;
  vu32 OBR;
  vu32 WRPR;
} FLASH_TypeDef;

typedef struct
{
  vu16 RDP;
  vu16 USER;
  vu16 Data0;
  vu16 Data1;
  vu16 WRP0;
  vu16 WRP1;
  vu16 WRP2;
  vu16 WRP3;
} OB_TypeDef;

 
typedef struct
{
  vu32 BTCR[8];   
} FSMC_Bank1_TypeDef; 

typedef struct
{
  vu32 BWTR[7];
} FSMC_Bank1E_TypeDef;

typedef struct
{
  vu32 PCR2;
  vu32 SR2;
  vu32 PMEM2;
  vu32 PATT2;
  u32  RESERVED0;   
  vu32 ECCR2; 
} FSMC_Bank2_TypeDef;  

typedef struct
{
  vu32 PCR3;
  vu32 SR3;
  vu32 PMEM3;
  vu32 PATT3;
  u32  RESERVED0;   
  vu32 ECCR3; 
} FSMC_Bank3_TypeDef; 

typedef struct
{
  vu32 PCR4;
  vu32 SR4;
  vu32 PMEM4;
  vu32 PATT4;
  vu32 PIO4; 
} FSMC_Bank4_TypeDef; 

 
typedef struct
{
  vu32 CRL;
  vu32 CRH;
  vu32 IDR;
  vu32 ODR;
  vu32 BSRR;
  vu32 BRR;
  vu32 LCKR;
} GPIO_TypeDef;

typedef struct
{
  vu32 EVCR;
  vu32 MAPR;
  vu32 EXTICR[4];
} AFIO_TypeDef;

 
typedef struct
{
  vu16 CR1;
  u16  RESERVED0;
  vu16 CR2;
  u16  RESERVED1;
  vu16 OAR1;
  u16  RESERVED2;
  vu16 OAR2;
  u16  RESERVED3;
  vu16 DR;
  u16  RESERVED4;
  vu16 SR1;
  u16  RESERVED5;
  vu16 SR2;
  u16  RESERVED6;
  vu16 CCR;
  u16  RESERVED7;
  vu16 TRISE;
  u16  RESERVED8;
} I2C_TypeDef;

 
typedef struct
{
  vu32 KR;
  vu32 PR;
  vu32 RLR;
  vu32 SR;
} IWDG_TypeDef;

 
typedef struct
{
  vu32 ISER[2];
  u32  RESERVED0[30];
  vu32 ICER[2];
  u32  RSERVED1[30];
  vu32 ISPR[2];
  u32  RESERVED2[30];
  vu32 ICPR[2];
  u32  RESERVED3[30];
  vu32 IABR[2];
  u32  RESERVED4[62];
  vu32 IPR[15];
} NVIC_TypeDef;

typedef struct
{
  vuc32 CPUID;
  vu32 ICSR;
  vu32 VTOR;
  vu32 AIRCR;
  vu32 SCR;
  vu32 CCR;
  vu32 SHPR[3];
  vu32 SHCSR;
  vu32 CFSR;
  vu32 HFSR;
  vu32 DFSR;
  vu32 MMFAR;
  vu32 BFAR;
  vu32 AFSR;
} SCB_TypeDef;

 
typedef struct
{
  vu32 CR;
  vu32 CSR;
} PWR_TypeDef;

 
typedef struct
{
  vu32 CR;
  vu32 CFGR;
  vu32 CIR;
  vu32 APB2RSTR;
  vu32 APB1RSTR;
  vu32 AHBENR;
  vu32 APB2ENR;
  vu32 APB1ENR;
  vu32 BDCR;
  vu32 CSR;
} RCC_TypeDef;

 
typedef struct
{
  vu16 CRH;
  u16  RESERVED0;
  vu16 CRL;
  u16  RESERVED1;
  vu16 PRLH;
  u16  RESERVED2;
  vu16 PRLL;
  u16  RESERVED3;
  vu16 DIVH;
  u16  RESERVED4;
  vu16 DIVL;
  u16  RESERVED5;
  vu16 CNTH;
  u16  RESERVED6;
  vu16 CNTL;
  u16  RESERVED7;
  vu16 ALRH;
  u16  RESERVED8;
  vu16 ALRL;
  u16  RESERVED9;
} RTC_TypeDef;

 
typedef struct
{
  vu32 POWER;
  vu32 CLKCR;
  vu32 ARG;
  vu32 CMD;
  vuc32 RESPCMD;
  vuc32 RESP1;
  vuc32 RESP2;
  vuc32 RESP3;
  vuc32 RESP4;
  vu32 DTIMER;
  vu32 DLEN;
  vu32 DCTRL;
  vuc32 DCOUNT;
  vuc32 STA;
  vu32 ICR;
  vu32 MASK;
  u32  RESERVED0[2];
  vuc32 FIFOCNT;
  u32  RESERVED1[13];
  vu32 FIFO;
} SDIO_TypeDef;

 
typedef struct
{
  vu16 CR1;
  u16  RESERVED0;
  vu16 CR2;
  u16  RESERVED1;
  vu16 SR;
  u16  RESERVED2;
  vu16 DR;
  u16  RESERVED3;
  vu16 CRCPR;
  u16  RESERVED4;
  vu16 RXCRCR;
  u16  RESERVED5;
  vu16 TXCRCR;
  u16  RESERVED6;
  vu16 I2SCFGR;
  u16  RESERVED7;
  vu16 I2SPR;
  u16  RESERVED8;  
} SPI_TypeDef;

 
typedef struct
{
  vu32 CTRL;
  vu32 LOAD;
  vu32 VAL;
  vuc32 CALIB;
} SysTick_TypeDef;

 
typedef struct
{
  vu16 CR1;
  u16  RESERVED0;
  vu16 CR2;
  u16  RESERVED1;
  vu16 SMCR;
  u16  RESERVED2;
  vu16 DIER;
  u16  RESERVED3;
  vu16 SR;
  u16  RESERVED4;
  vu16 EGR;
  u16  RESERVED5;
  vu16 CCMR1;
  u16  RESERVED6;
  vu16 CCMR2;
  u16  RESERVED7;
  vu16 CCER;
  u16  RESERVED8;
  vu16 CNT;
  u16  RESERVED9;
  vu16 PSC;
  u16  RESERVED10;
  vu16 ARR;
  u16  RESERVED11;
  vu16 RCR;
  u16  RESERVED12;
  vu16 CCR1;
  u16  RESERVED13;
  vu16 CCR2;
  u16  RESERVED14;
  vu16 CCR3;
  u16  RESERVED15;
  vu16 CCR4;
  u16  RESERVED16;
  vu16 BDTR;
  u16  RESERVED17;
  vu16 DCR;
  u16  RESERVED18;
  vu16 DMAR;
  u16  RESERVED19;
} TIM_TypeDef;

 
typedef struct
{
  vu16 SR;
  u16  RESERVED0;
  vu16 DR;
  u16  RESERVED1;
  vu16 BRR;
  u16  RESERVED2;
  vu16 CR1;
  u16  RESERVED3;
  vu16 CR2;
  u16  RESERVED4;
  vu16 CR3;
  u16  RESERVED5;
  vu16 GTPR;
  u16  RESERVED6;
} USART_TypeDef;

 
typedef struct
{
  vu32 CR;
  vu32 CFR;
  vu32 SR;
} WWDG_TypeDef;

 
 
 
 



 



 


 




#line 634 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_map.h"

#line 651 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_map.h"



#line 670 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_map.h"

 

 


 






 


 






 
 
 

 



























































































































































































































#line 924 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_map.h"














 
#line 1180 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_map.h"

 
 
 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"

#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_adc.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_adc.h"

 
 
typedef struct
{
  u32 ADC_Mode;
  FunctionalState ADC_ScanConvMode; 
  FunctionalState ADC_ContinuousConvMode;
  u32 ADC_ExternalTrigConv;
  u32 ADC_DataAlign;
  u8 ADC_NbrOfChannel;
}ADC_InitTypeDef;

 



                                 



 
#line 55 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_adc.h"

#line 66 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_adc.h"

 
 
#line 75 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_adc.h"
 


 
#line 85 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_adc.h"

#line 100 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_adc.h"

 






 
#line 127 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_adc.h"

#line 137 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_adc.h"

 
#line 147 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_adc.h"

#line 156 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_adc.h"

 
 





 



 






#line 188 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_adc.h"

 










 
#line 208 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_adc.h"

#line 216 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_adc.h"

 








 











 


 


 


 


 


 


 


 
 
void ADC_DeInit(ADC_TypeDef* ADCx);
void ADC_Init(ADC_TypeDef* ADCx, ADC_InitTypeDef* ADC_InitStruct);
void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct);
void ADC_Cmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_DMACmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_ITConfig(ADC_TypeDef* ADCx, u16 ADC_IT, FunctionalState NewState);
void ADC_ResetCalibration(ADC_TypeDef* ADCx);
FlagStatus ADC_GetResetCalibrationStatus(ADC_TypeDef* ADCx);
void ADC_StartCalibration(ADC_TypeDef* ADCx);
FlagStatus ADC_GetCalibrationStatus(ADC_TypeDef* ADCx);
void ADC_SoftwareStartConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
FlagStatus ADC_GetSoftwareStartConvStatus(ADC_TypeDef* ADCx);
void ADC_DiscModeChannelCountConfig(ADC_TypeDef* ADCx, u8 Number);
void ADC_DiscModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_RegularChannelConfig(ADC_TypeDef* ADCx, u8 ADC_Channel, u8 Rank, u8 ADC_SampleTime);
void ADC_ExternalTrigConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
u16 ADC_GetConversionValue(ADC_TypeDef* ADCx);
u32 ADC_GetDualModeConversionValue(void);
void ADC_AutoInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_InjectedDiscModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_ExternalTrigInjectedConvConfig(ADC_TypeDef* ADCx, u32 ADC_ExternalTrigInjecConv);
void ADC_ExternalTrigInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_SoftwareStartInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
FlagStatus ADC_GetSoftwareStartInjectedConvCmdStatus(ADC_TypeDef* ADCx);
void ADC_InjectedChannelConfig(ADC_TypeDef* ADCx, u8 ADC_Channel, u8 Rank, u8 ADC_SampleTime);
void ADC_InjectedSequencerLengthConfig(ADC_TypeDef* ADCx, u8 Length);
void ADC_SetInjectedOffset(ADC_TypeDef* ADCx, u8 ADC_InjectedChannel, u16 Offset);
u16 ADC_GetInjectedConversionValue(ADC_TypeDef* ADCx, u8 ADC_InjectedChannel);
void ADC_AnalogWatchdogCmd(ADC_TypeDef* ADCx, u32 ADC_AnalogWatchdog);
void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef* ADCx, u16 HighThreshold, u16 LowThreshold);
void ADC_AnalogWatchdogSingleChannelConfig(ADC_TypeDef* ADCx, u8 ADC_Channel);
void ADC_TempSensorVrefintCmd(FunctionalState NewState);
FlagStatus ADC_GetFlagStatus(ADC_TypeDef* ADCx, u8 ADC_FLAG);
void ADC_ClearFlag(ADC_TypeDef* ADCx, u8 ADC_FLAG);
ITStatus ADC_GetITStatus(ADC_TypeDef* ADCx, u16 ADC_IT);
void ADC_ClearITPendingBit(ADC_TypeDef* ADCx, u16 ADC_IT);



 
#line 26 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_bkp.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_bkp.h"

 
 
 






 










 
#line 87 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_bkp.h"

#line 102 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_bkp.h"



 
 
void BKP_DeInit(void);
void BKP_TamperPinLevelConfig(u16 BKP_TamperPinLevel);
void BKP_TamperPinCmd(FunctionalState NewState);
void BKP_ITConfig(FunctionalState NewState);
void BKP_RTCOutputConfig(u16 BKP_RTCOutputSource);
void BKP_SetRTCCalibrationValue(u8 CalibrationValue);
void BKP_WriteBackupRegister(u16 BKP_DR, u16 Data);
u16 BKP_ReadBackupRegister(u16 BKP_DR);
FlagStatus BKP_GetFlagStatus(void);
void BKP_ClearFlag(void);
ITStatus BKP_GetITStatus(void);
void BKP_ClearITPendingBit(void);



 
#line 30 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_can.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_can.h"

 
 
typedef struct
{
  FunctionalState CAN_TTCM;
  FunctionalState CAN_ABOM;
  FunctionalState CAN_AWUM;
  FunctionalState CAN_NART;
  FunctionalState CAN_RFLM;
  FunctionalState CAN_TXFP;
  u8 CAN_Mode;
  u8 CAN_SJW;
  u8 CAN_BS1;
  u8 CAN_BS2;
  u16 CAN_Prescaler;
} CAN_InitTypeDef;

 
typedef struct
{
  u8 CAN_FilterNumber;
  u8 CAN_FilterMode;
  u8 CAN_FilterScale;
  u16 CAN_FilterIdHigh;
  u16 CAN_FilterIdLow;
  u16 CAN_FilterMaskIdHigh;
  u16 CAN_FilterMaskIdLow;
  u16 CAN_FilterFIFOAssignment;
  FunctionalState CAN_FilterActivation;
} CAN_FilterInitTypeDef;

 
typedef struct
{
  u32 StdId;
  u32 ExtId;
  u8 IDE;
  u8 RTR;
  u8 DLC;
  u8 Data[8];
} CanTxMsg;

 
typedef struct
{
  u32 StdId;
  u32 ExtId;
  u8 IDE;
  u8 RTR;
  u8 DLC;
  u8 Data[8];
  u8 FMI;
} CanRxMsg;

 

 



 








 








 
#line 119 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_can.h"



 
#line 131 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_can.h"



 


 


 






 






 






 





 





 





 





 





 



 



 







 
#line 225 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_can.h"

#line 233 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_can.h"

#line 240 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_can.h"

 
 
void CAN_DeInit(void);
u8 CAN_Init(CAN_InitTypeDef* CAN_InitStruct);
void CAN_FilterInit(CAN_FilterInitTypeDef* CAN_FilterInitStruct);
void CAN_StructInit(CAN_InitTypeDef* CAN_InitStruct);
void CAN_ITConfig(u32 CAN_IT, FunctionalState NewState);
u8 CAN_Transmit(CanTxMsg* TxMessage);
u8 CAN_TransmitStatus(u8 TransmitMailbox);
void CAN_CancelTransmit(u8 Mailbox);
void CAN_FIFORelease(u8 FIFONumber);
u8 CAN_MessagePending(u8 FIFONumber);
void CAN_Receive(u8 FIFONumber, CanRxMsg* RxMessage);
u8 CAN_Sleep(void);
u8 CAN_WakeUp(void);
FlagStatus CAN_GetFlagStatus(u32 CAN_FLAG);
void CAN_ClearFlag(u32 CAN_FLAG);
ITStatus CAN_GetITStatus(u32 CAN_IT);
void CAN_ClearITPendingBit(u32 CAN_IT);



 
#line 34 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_crc.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_crc.h"

 
 
 
 
void CRC_ResetDR(void);
u32 CRC_CalcCRC(u32 Data);
u32 CRC_CalcBlockCRC(u32 pBuffer[], u32 BufferLength);
u32 CRC_GetCRC(void);
void CRC_SetIDRegister(u8 IDValue);
u8 CRC_GetIDRegister(void);



 
#line 38 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dac.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dac.h"

 
 
typedef struct
{
  u32 DAC_Trigger;
  u32 DAC_WaveGeneration;
  u32 DAC_LFSRUnmask_TriangleAmplitude;
  u32 DAC_OutputBuffer; 
}DAC_InitTypeDef;

 
 
#line 45 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dac.h"

#line 55 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dac.h"

 








 
#line 78 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dac.h"

#line 91 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dac.h"

#line 116 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dac.h"

 






 






 








 






 


 
 
void DAC_DeInit(void);
void DAC_Init(u32 DAC_Channel, DAC_InitTypeDef* DAC_InitStruct);
void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct);
void DAC_Cmd(u32 DAC_Channel, FunctionalState NewState);
void DAC_DMACmd(u32 DAC_Channel, FunctionalState NewState);
void DAC_SoftwareTriggerCmd(u32 DAC_Channel, FunctionalState NewState);
void DAC_DualSoftwareTriggerCmd(FunctionalState NewState);
void DAC_WaveGenerationCmd(u32 DAC_Channel, u32 DAC_Wave, FunctionalState NewState);
void DAC_SetChannel1Data(u32 DAC_Align, u16 Data);
void DAC_SetChannel2Data(u32 DAC_Align, u16 Data);
void DAC_SetDualChannelData(u32 DAC_Align, u16 Data2, u16 Data1);
u16 DAC_GetDataOutputValue(u32 DAC_Channel);



 
#line 42 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dbgmcu.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dbgmcu.h"

 
 
#line 42 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dbgmcu.h"
                                           


 
 
u32 DBGMCU_GetREVID(void);
u32 DBGMCU_GetDEVID(void);
void DBGMCU_Config(u32 DBGMCU_Periph, FunctionalState NewState);



 


#line 46 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dma.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dma.h"

 
 
typedef struct
{
  u32 DMA_PeripheralBaseAddr;
  u32 DMA_MemoryBaseAddr;
  u32 DMA_DIR;
  u32 DMA_BufferSize;
  u32 DMA_PeripheralInc;
  u32 DMA_MemoryInc;
  u32 DMA_PeripheralDataSize;
  u32 DMA_MemoryDataSize;
  u32 DMA_Mode;
  u32 DMA_Priority;
  u32 DMA_M2M;
}DMA_InitTypeDef;

 
#line 54 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dma.h"

 






 






 






 








 








 





 










 





 






 
#line 153 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dma.h"
 
#line 174 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dma.h"

#line 200 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dma.h"

 
 
#line 231 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dma.h"
 
#line 252 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dma.h"

#line 278 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_dma.h"

 


 
 
void DMA_DeInit(DMA_Channel_TypeDef* DMAy_Channelx);
void DMA_Init(DMA_Channel_TypeDef* DMAy_Channelx, DMA_InitTypeDef* DMA_InitStruct);
void DMA_StructInit(DMA_InitTypeDef* DMA_InitStruct);
void DMA_Cmd(DMA_Channel_TypeDef* DMAy_Channelx, FunctionalState NewState);
void DMA_ITConfig(DMA_Channel_TypeDef* DMAy_Channelx, u32 DMA_IT, FunctionalState NewState);
u16 DMA_GetCurrDataCounter(DMA_Channel_TypeDef* DMAy_Channelx);
FlagStatus DMA_GetFlagStatus(u32 DMA_FLAG);
void DMA_ClearFlag(u32 DMA_FLAG);
ITStatus DMA_GetITStatus(u32 DMA_IT);
void DMA_ClearITPendingBit(u32 DMA_IT);



 
#line 50 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_exti.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_exti.h"

 
 
typedef enum
{
  EXTI_Mode_Interrupt = 0x00,
  EXTI_Mode_Event = 0x04
}EXTIMode_TypeDef;


                            
 
typedef enum
{
  EXTI_Trigger_Rising = 0x08,
  EXTI_Trigger_Falling = 0x0C,  
  EXTI_Trigger_Rising_Falling = 0x10
}EXTITrigger_TypeDef;





 
typedef struct
{
  u32 EXTI_Line;
  EXTIMode_TypeDef EXTI_Mode;
  EXTITrigger_TypeDef EXTI_Trigger;
  FunctionalState EXTI_LineCmd;
}EXTI_InitTypeDef;

 
 
#line 80 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_exti.h"



#line 93 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_exti.h"
                                 
 
 
void EXTI_DeInit(void);
void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct);
void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct);
void EXTI_GenerateSWInterrupt(u32 EXTI_Line);
FlagStatus EXTI_GetFlagStatus(u32 EXTI_Line);
void EXTI_ClearFlag(u32 EXTI_Line);
ITStatus EXTI_GetITStatus(u32 EXTI_Line);
void EXTI_ClearITPendingBit(u32 EXTI_Line);



 
#line 54 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_flash.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_flash.h"

 

 
typedef enum
{ 
  FLASH_BUSY = 1,
  FLASH_ERROR_PG,
  FLASH_ERROR_WRP,
  FLASH_COMPLETE,
  FLASH_TIMEOUT
}FLASH_Status;


 








 







 







 

 
#line 97 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_flash.h"

 
#line 132 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_flash.h"






 





 





 





 





 





 






								 
 
 
 
void FLASH_SetLatency(u32 FLASH_Latency);
void FLASH_HalfCycleAccessCmd(u32 FLASH_HalfCycleAccess);
void FLASH_PrefetchBufferCmd(u32 FLASH_PrefetchBuffer);


void FLASH_Unlock(void);
void FLASH_Lock(void);
FLASH_Status FLASH_ErasePage(u32 Page_Address);
FLASH_Status FLASH_EraseAllPages(void);
FLASH_Status FLASH_EraseOptionBytes(void);
FLASH_Status FLASH_ProgramWord(u32 Address, u32 Data);
FLASH_Status FLASH_ProgramHalfWord(u32 Address, u16 Data);
FLASH_Status FLASH_ProgramOptionByteData(u32 Address, u8 Data);
FLASH_Status FLASH_EnableWriteProtection(u32 FLASH_Pages);
FLASH_Status FLASH_ReadOutProtection(FunctionalState NewState);
FLASH_Status FLASH_UserOptionByteConfig(u16 OB_IWDG, u16 OB_STOP, u16 OB_STDBY);
u32 FLASH_GetUserOptionByte(void);
u32 FLASH_GetWriteProtectionOptionByte(void);
FlagStatus FLASH_GetReadOutProtectionStatus(void);
FlagStatus FLASH_GetPrefetchBufferStatus(void);
void FLASH_ITConfig(u16 FLASH_IT, FunctionalState NewState);
FlagStatus FLASH_GetFlagStatus(u16 FLASH_FLAG);
void FLASH_ClearFlag(u16 FLASH_FLAG);
FLASH_Status FLASH_GetStatus(void);
FLASH_Status FLASH_WaitForLastOperation(u32 Timeout);




 
#line 58 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_fsmc.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_fsmc.h"

 
 
typedef struct
{
  u32 FSMC_AddressSetupTime;
  u32 FSMC_AddressHoldTime;
  u32 FSMC_DataSetupTime;
  u32 FSMC_BusTurnAroundDuration;
  u32 FSMC_CLKDivision;
  u32 FSMC_DataLatency;
  u32 FSMC_AccessMode;
}FSMC_NORSRAMTimingInitTypeDef;

 
typedef struct
{
  u32 FSMC_Bank;
  u32 FSMC_DataAddressMux;
  u32 FSMC_MemoryType;
  u32 FSMC_MemoryDataWidth;
  u32 FSMC_BurstAccessMode;
  u32 FSMC_WaitSignalPolarity;
  u32 FSMC_WrapMode;
  u32 FSMC_WaitSignalActive;
  u32 FSMC_WriteOperation;
  u32 FSMC_WaitSignal;
  u32 FSMC_ExtendedMode;
  u32 FSMC_AsyncWait;
  u32 FSMC_WriteBurst;
   
  FSMC_NORSRAMTimingInitTypeDef* FSMC_ReadWriteTimingStruct;
   
  FSMC_NORSRAMTimingInitTypeDef* FSMC_WriteTimingStruct;
}FSMC_NORSRAMInitTypeDef;

 
typedef struct
{
  u32 FSMC_SetupTime;
  u32 FSMC_WaitSetupTime;
  u32 FSMC_HoldSetupTime;
  u32 FSMC_HiZSetupTime;
}FSMC_NAND_PCCARDTimingInitTypeDef;

 
typedef struct
{
  u32 FSMC_Bank;
  u32 FSMC_Waitfeature;
  u32 FSMC_MemoryDataWidth;
  u32 FSMC_ECC;
  u32 FSMC_ECCPageSize;
  u32 FSMC_AddressLowMapping;
  u32 FSMC_TCLRSetupTime;
  u32 FSMC_TARSetupTime;
   
  FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_CommonSpaceTimingStruct;
   
  FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_AttributeSpaceTimingStruct;
}FSMC_NANDInitTypeDef;

 
typedef struct
{
  u32 FSMC_Waitfeature;
  u32 FSMC_AddressLowMapping;
  u32 FSMC_TCLRSetupTime;
  u32 FSMC_TARSetupTime;
   
  FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_CommonSpaceTimingStruct;
   
  FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_AttributeSpaceTimingStruct;
   
  FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_IOSpaceTimingStruct;
}FSMC_PCCARDInitTypeDef;

 
 
#line 109 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_fsmc.h"













                                    





 
 






 









                                     
 





                                      
                               
 






                                   





                                        
  





                                 
                                  





                                    
 





                              
 






 





                               
 





                                  
                                   






 


 


 


 


 


 


 









                                  
 
 





                                    
 





                                    
 





                                            
 
#line 276 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_fsmc.h"

#line 283 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_fsmc.h"
                                                              
 





 


 


 


 


 


 


 










 











 
 
void FSMC_NORSRAMDeInit(u32 FSMC_Bank);
void FSMC_NANDDeInit(u32 FSMC_Bank);
void FSMC_PCCARDDeInit(void);
void FSMC_NORSRAMInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);
void FSMC_NANDInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);
void FSMC_PCCARDInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
void FSMC_NORSRAMStructInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);
void FSMC_NANDStructInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);
void FSMC_PCCARDStructInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
void FSMC_NORSRAMCmd(u32 FSMC_Bank, FunctionalState NewState);
void FSMC_NANDCmd(u32 FSMC_Bank, FunctionalState NewState);
void FSMC_PCCARDCmd(FunctionalState NewState);
void FSMC_NANDECCCmd(u32 FSMC_Bank, FunctionalState NewState);
u32 FSMC_GetECC(u32 FSMC_Bank);
void FSMC_ITConfig(u32 FSMC_Bank, u32 FSMC_IT, FunctionalState NewState);
FlagStatus FSMC_GetFlagStatus(u32 FSMC_Bank, u32 FSMC_FLAG);
void FSMC_ClearFlag(u32 FSMC_Bank, u32 FSMC_FLAG);
ITStatus FSMC_GetITStatus(u32 FSMC_Bank, u32 FSMC_IT);
void FSMC_ClearITPendingBit(u32 FSMC_Bank, u32 FSMC_IT);



 
#line 62 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_gpio.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_gpio.h"

 
#line 32 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_gpio.h"
                                     
 
typedef enum
{ 
  GPIO_Speed_10MHz = 1,
  GPIO_Speed_2MHz, 
  GPIO_Speed_50MHz
}GPIOSpeed_TypeDef;



                                         
 
typedef enum
{ GPIO_Mode_AIN = 0x0,
  GPIO_Mode_IN_FLOATING = 0x04,
  GPIO_Mode_IPD = 0x28,
  GPIO_Mode_IPU = 0x48,
  GPIO_Mode_Out_OD = 0x14,
  GPIO_Mode_Out_PP = 0x10,
  GPIO_Mode_AF_OD = 0x1C,
  GPIO_Mode_AF_PP = 0x18
}GPIOMode_TypeDef;





                              
 
typedef struct
{
  u16 GPIO_Pin;
  GPIOSpeed_TypeDef GPIO_Speed;
  GPIOMode_TypeDef GPIO_Mode;
}GPIO_InitTypeDef;

 
typedef enum
{ Bit_RESET = 0,
  Bit_SET
}BitAction;


 
 
#line 95 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_gpio.h"



#line 114 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_gpio.h"
                            
 
#line 141 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_gpio.h"


#line 156 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_gpio.h"
                              
 
#line 165 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_gpio.h"






                                         
#line 179 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_gpio.h"
                                       
 
#line 197 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_gpio.h"

#line 214 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_gpio.h"
                          
 
 
void GPIO_DeInit(GPIO_TypeDef* GPIOx);
void GPIO_AFIODeInit(void);
void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);
void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);
u8 GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin);
u16 GPIO_ReadInputData(GPIO_TypeDef* GPIOx);
u8 GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin);
u16 GPIO_ReadOutputData(GPIO_TypeDef* GPIOx);
void GPIO_SetBits(GPIO_TypeDef* GPIOx, u16 GPIO_Pin);
void GPIO_ResetBits(GPIO_TypeDef* GPIOx, u16 GPIO_Pin);
void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin, BitAction BitVal);
void GPIO_Write(GPIO_TypeDef* GPIOx, u16 PortVal);
void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, u16 GPIO_Pin);
void GPIO_EventOutputConfig(u8 GPIO_PortSource, u8 GPIO_PinSource);
void GPIO_EventOutputCmd(FunctionalState NewState);
void GPIO_PinRemapConfig(u32 GPIO_Remap, FunctionalState NewState);
void GPIO_EXTILineConfig(u8 GPIO_PortSource, u8 GPIO_PinSource);



 
#line 66 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_i2c.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_i2c.h"

 
 
typedef struct
{
  u16 I2C_Mode;
  u16 I2C_DutyCycle;
  u16 I2C_OwnAddress1;
  u16 I2C_Ack;
  u16 I2C_AcknowledgedAddress;
  u32 I2C_ClockSpeed;
}I2C_InitTypeDef;

 



 







 






 






 






 






 
#line 86 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_i2c.h"

#line 96 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_i2c.h"

 






 






 






 
#line 133 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_i2c.h"

#line 140 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_i2c.h"

#line 148 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_i2c.h"

 
#line 171 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_i2c.h"

#line 178 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_i2c.h"

#line 190 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_i2c.h"

 
 






 

     
 


 


 


 



 


 

      
 

                                          
 


#line 246 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_i2c.h"

 

 


 
 
void I2C_DeInit(I2C_TypeDef* I2Cx);
void I2C_Init(I2C_TypeDef* I2Cx, I2C_InitTypeDef* I2C_InitStruct);
void I2C_StructInit(I2C_InitTypeDef* I2C_InitStruct);
void I2C_Cmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_DMACmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_DMALastTransferCmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_GenerateSTART(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_GenerateSTOP(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_AcknowledgeConfig(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_OwnAddress2Config(I2C_TypeDef* I2Cx, u8 Address);
void I2C_DualAddressCmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_GeneralCallCmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_ITConfig(I2C_TypeDef* I2Cx, u16 I2C_IT, FunctionalState NewState);
void I2C_SendData(I2C_TypeDef* I2Cx, u8 Data);
u8 I2C_ReceiveData(I2C_TypeDef* I2Cx);
void I2C_Send7bitAddress(I2C_TypeDef* I2Cx, u8 Address, u8 I2C_Direction);
u16 I2C_ReadRegister(I2C_TypeDef* I2Cx, u8 I2C_Register);
void I2C_SoftwareResetCmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_SMBusAlertConfig(I2C_TypeDef* I2Cx, u16 I2C_SMBusAlert);
void I2C_TransmitPEC(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_PECPositionConfig(I2C_TypeDef* I2Cx, u16 I2C_PECPosition);
void I2C_CalculatePEC(I2C_TypeDef* I2Cx, FunctionalState NewState);
u8 I2C_GetPEC(I2C_TypeDef* I2Cx);
void I2C_ARPCmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_StretchClockCmd(I2C_TypeDef* I2Cx, FunctionalState NewState);
void I2C_FastModeDutyCycleConfig(I2C_TypeDef* I2Cx, u16 I2C_DutyCycle);
u32 I2C_GetLastEvent(I2C_TypeDef* I2Cx);
ErrorStatus I2C_CheckEvent(I2C_TypeDef* I2Cx, u32 I2C_EVENT);
FlagStatus I2C_GetFlagStatus(I2C_TypeDef* I2Cx, u32 I2C_FLAG);
void I2C_ClearFlag(I2C_TypeDef* I2Cx, u32 I2C_FLAG);
ITStatus I2C_GetITStatus(I2C_TypeDef* I2Cx, u32 I2C_IT);
void I2C_ClearITPendingBit(I2C_TypeDef* I2Cx, u32 I2C_IT);



 
#line 70 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_iwdg.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_iwdg.h"

 
 
 






 
#line 41 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_iwdg.h"

#line 49 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_iwdg.h"

 







 
 
void IWDG_WriteAccessCmd(u16 IWDG_WriteAccess);
void IWDG_SetPrescaler(u8 IWDG_Prescaler);
void IWDG_SetReload(u16 Reload);
void IWDG_ReloadCounter(void);
void IWDG_Enable(void);
FlagStatus IWDG_GetFlagStatus(u16 IWDG_FLAG);



 
#line 74 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_nvic.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_nvic.h"

 
 
typedef struct
{
  u8 NVIC_IRQChannel;
  u8 NVIC_IRQChannelPreemptionPriority;
  u8 NVIC_IRQChannelSubPriority;
  FunctionalState NVIC_IRQChannelCmd;
} NVIC_InitTypeDef;

 
 
#line 96 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_nvic.h"


#line 158 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_nvic.h"


 
#line 170 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_nvic.h"





#line 182 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_nvic.h"












#line 201 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_nvic.h"











 






 








 
#line 239 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_nvic.h"












 
 
void NVIC_DeInit(void);
void NVIC_SCBDeInit(void);
void NVIC_PriorityGroupConfig(u32 NVIC_PriorityGroup);
void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
void NVIC_StructInit(NVIC_InitTypeDef* NVIC_InitStruct);
void NVIC_SETPRIMASK(void);
void NVIC_RESETPRIMASK(void);
void NVIC_SETFAULTMASK(void);
void NVIC_RESETFAULTMASK(void);
void NVIC_BASEPRICONFIG(u32 NewPriority);
u32 NVIC_GetBASEPRI(void);
u16 NVIC_GetCurrentPendingIRQChannel(void);
ITStatus NVIC_GetIRQChannelPendingBitStatus(u8 NVIC_IRQChannel);
void NVIC_SetIRQChannelPendingBit(u8 NVIC_IRQChannel);
void NVIC_ClearIRQChannelPendingBit(u8 NVIC_IRQChannel);
u16 NVIC_GetCurrentActiveHandler(void);
ITStatus NVIC_GetIRQChannelActiveBitStatus(u8 NVIC_IRQChannel);
u32 NVIC_GetCPUID(void);
void NVIC_SetVectorTable(u32 NVIC_VectTab, u32 Offset);
void NVIC_GenerateSystemReset(void);
void NVIC_GenerateCoreReset(void);
void NVIC_SystemLPConfig(u8 LowPowerMode, FunctionalState NewState);
void NVIC_SystemHandlerConfig(u32 SystemHandler, FunctionalState NewState);
void NVIC_SystemHandlerPriorityConfig(u32 SystemHandler, u8 SystemHandlerPreemptionPriority,
                                      u8 SystemHandlerSubPriority);
ITStatus NVIC_GetSystemHandlerPendingBitStatus(u32 SystemHandler);
void NVIC_SetSystemHandlerPendingBit(u32 SystemHandler);
void NVIC_ClearSystemHandlerPendingBit(u32 SystemHandler);
ITStatus NVIC_GetSystemHandlerActiveBitStatus(u32 SystemHandler);
u32 NVIC_GetFaultHandlerSources(u32 SystemHandler);
u32 NVIC_GetFaultAddress(u32 SystemHandler);



 
#line 78 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_pwr.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_pwr.h"

 
 
 
#line 35 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_pwr.h"






 






 




 
 








 
 
void PWR_DeInit(void);
void PWR_BackupAccessCmd(FunctionalState NewState);
void PWR_PVDCmd(FunctionalState NewState);
void PWR_PVDLevelConfig(u32 PWR_PVDLevel);
void PWR_WakeUpPinCmd(FunctionalState NewState);
void PWR_EnterSTOPMode(u32 PWR_Regulator, u8 PWR_STOPEntry);
void PWR_EnterSTANDBYMode(void);
FlagStatus PWR_GetFlagStatus(u32 PWR_FLAG);
void PWR_ClearFlag(u32 PWR_FLAG);



 
#line 82 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_rcc.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_rcc.h"

 
typedef struct
{
  u32 SYSCLK_Frequency;
  u32 HCLK_Frequency;
  u32 PCLK1_Frequency;
  u32 PCLK2_Frequency;
  u32 ADCCLK_Frequency;
}RCC_ClocksTypeDef;

 
 







 








 
#line 68 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_rcc.h"

#line 77 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_rcc.h"

 








 
#line 97 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_rcc.h"







 










 
#line 122 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_rcc.h"







 






 








 







 








 
#line 170 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_rcc.h"



 
#line 190 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_rcc.h"



 
#line 215 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_rcc.h"



 










 
#line 241 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_rcc.h"

#line 248 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_rcc.h"



 
 
void RCC_DeInit(void);
void RCC_HSEConfig(u32 RCC_HSE);
ErrorStatus RCC_WaitForHSEStartUp(void);
void RCC_AdjustHSICalibrationValue(u8 HSICalibrationValue);
void RCC_HSICmd(FunctionalState NewState);
void RCC_PLLConfig(u32 RCC_PLLSource, u32 RCC_PLLMul);
void RCC_PLLCmd(FunctionalState NewState);
void RCC_SYSCLKConfig(u32 RCC_SYSCLKSource);
u8 RCC_GetSYSCLKSource(void);
void RCC_HCLKConfig(u32 RCC_SYSCLK);
void RCC_PCLK1Config(u32 RCC_HCLK);
void RCC_PCLK2Config(u32 RCC_HCLK);
void RCC_ITConfig(u8 RCC_IT, FunctionalState NewState);
void RCC_USBCLKConfig(u32 RCC_USBCLKSource);
void RCC_ADCCLKConfig(u32 RCC_PCLK2);
void RCC_LSEConfig(u8 RCC_LSE);
void RCC_LSICmd(FunctionalState NewState);
void RCC_RTCCLKConfig(u32 RCC_RTCCLKSource);
void RCC_RTCCLKCmd(FunctionalState NewState);
void RCC_GetClocksFreq(RCC_ClocksTypeDef* RCC_Clocks);
void RCC_AHBPeriphClockCmd(u32 RCC_AHBPeriph, FunctionalState NewState);
void RCC_APB2PeriphClockCmd(u32 RCC_APB2Periph, FunctionalState NewState);
void RCC_APB1PeriphClockCmd(u32 RCC_APB1Periph, FunctionalState NewState);
void RCC_APB2PeriphResetCmd(u32 RCC_APB2Periph, FunctionalState NewState);
void RCC_APB1PeriphResetCmd(u32 RCC_APB1Periph, FunctionalState NewState);
void RCC_BackupResetCmd(FunctionalState NewState);
void RCC_ClockSecuritySystemCmd(FunctionalState NewState);
void RCC_MCOConfig(u8 RCC_MCO);
FlagStatus RCC_GetFlagStatus(u8 RCC_FLAG);
void RCC_ClearFlag(void);
ITStatus RCC_GetITStatus(u8 RCC_IT);
void RCC_ClearITPendingBit(u8 RCC_IT);



 
#line 86 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_rtc.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_rtc.h"

 
 
 








                                                                     
 













                           
 
 
void RTC_ITConfig(u16 RTC_IT, FunctionalState NewState);
void RTC_EnterConfigMode(void);
void RTC_ExitConfigMode(void);
u32  RTC_GetCounter(void);
void RTC_SetCounter(u32 CounterValue);
void RTC_SetPrescaler(u32 PrescalerValue);
void RTC_SetAlarm(u32 AlarmValue);
u32  RTC_GetDivider(void);
void RTC_WaitForLastTask(void);
void RTC_WaitForSynchro(void);
FlagStatus RTC_GetFlagStatus(u16 RTC_FLAG);
void RTC_ClearFlag(u16 RTC_FLAG);
ITStatus RTC_GetITStatus(u16 RTC_IT);
void RTC_ClearITPendingBit(u16 RTC_IT);



 
#line 90 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_sdio.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_sdio.h"

 
typedef struct
{
  u8 SDIO_ClockDiv;
  u32 SDIO_ClockEdge;
  u32 SDIO_ClockBypass;
  u32 SDIO_ClockPowerSave;
  u32 SDIO_BusWide;
  u32 SDIO_HardwareFlowControl;
} SDIO_InitTypeDef;

typedef struct
{
  u32 SDIO_Argument;
  u32 SDIO_CmdIndex;
  u32 SDIO_Response;
  u32 SDIO_Wait;
  u32 SDIO_CPSM;
} SDIO_CmdInitTypeDef;

typedef struct
{
  u32 SDIO_DataTimeOut;
  u32 SDIO_DataLength;
  u32 SDIO_DataBlockSize;
  u32 SDIO_TransferDir;
  u32 SDIO_TransferMode;
  u32 SDIO_DPSM;
} SDIO_DataInitTypeDef;

 
 





                                   






  






 






                                
  





                                  
 





 
#line 121 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_sdio.h"



 


 








 







 





 








 


 
#line 178 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_sdio.h"

#line 194 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_sdio.h"

 






 






 





 
#line 240 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_sdio.h"

#line 265 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_sdio.h"



#line 292 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_sdio.h"


                                                        
 






 
 
void SDIO_DeInit(void);
void SDIO_Init(SDIO_InitTypeDef* SDIO_InitStruct);
void SDIO_StructInit(SDIO_InitTypeDef* SDIO_InitStruct);
void SDIO_ClockCmd(FunctionalState NewState);
void SDIO_SetPowerState(u32 SDIO_PowerState);
u32 SDIO_GetPowerState(void);
void SDIO_ITConfig(u32 SDIO_IT, FunctionalState NewState);
void SDIO_DMACmd(FunctionalState NewState);
void SDIO_SendCommand(SDIO_CmdInitTypeDef *SDIO_CmdInitStruct);
void SDIO_CmdStructInit(SDIO_CmdInitTypeDef* SDIO_CmdInitStruct);
u8 SDIO_GetCommandResponse(void);
u32 SDIO_GetResponse(u32 SDIO_RESP);
void SDIO_DataConfig(SDIO_DataInitTypeDef* SDIO_DataInitStruct);
void SDIO_DataStructInit(SDIO_DataInitTypeDef* SDIO_DataInitStruct);
u32 SDIO_GetDataCounter(void);
u32 SDIO_ReadData(void);
void SDIO_WriteData(u32 Data);
u32 SDIO_GetFIFOCount(void);
void SDIO_StartSDIOReadWait(FunctionalState NewState);
void SDIO_StopSDIOReadWait(FunctionalState NewState);
void SDIO_SetSDIOReadWaitMode(u32 SDIO_ReadWaitMode);
void SDIO_SetSDIOOperation(FunctionalState NewState);
void SDIO_SendSDIOSuspendCmd(FunctionalState NewState);
void SDIO_CommandCompletionCmd(FunctionalState NewState);
void SDIO_CEATAITCmd(FunctionalState NewState);
void SDIO_SendCEATACmd(FunctionalState NewState);
FlagStatus SDIO_GetFlagStatus(u32 SDIO_FLAG);
void SDIO_ClearFlag(u32 SDIO_FLAG);
ITStatus SDIO_GetITStatus(u32 SDIO_IT);
void SDIO_ClearITPendingBit(u32 SDIO_IT);



 
#line 94 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_spi.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_spi.h"

 
 
typedef struct
{
  u16 SPI_Direction;
  u16 SPI_Mode;
  u16 SPI_DataSize;
  u16 SPI_CPOL;
  u16 SPI_CPHA;
  u16 SPI_NSS;
  u16 SPI_BaudRatePrescaler;
  u16 SPI_FirstBit;
  u16 SPI_CRCPolynomial;
}SPI_InitTypeDef;

 
typedef struct
{
  u16 I2S_Mode;
  u16 I2S_Standard;
  u16 I2S_DataFormat;
  u16 I2S_MCLKOutput;
  u16 I2S_AudioFreq;
  u16 I2S_CPOL;
}I2S_InitTypeDef;

 








 










 






 






 






 






 






 
#line 114 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_spi.h"

#line 123 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_spi.h"

 






 










 












 










  






 
#line 180 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_spi.h"

#line 187 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_spi.h"

 






 





 






 





 






 






















 
#line 253 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_spi.h"

#line 260 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_spi.h"

 


 
 
void SPI_I2S_DeInit(SPI_TypeDef* SPIx);
void SPI_Init(SPI_TypeDef* SPIx, SPI_InitTypeDef* SPI_InitStruct);
void I2S_Init(SPI_TypeDef* SPIx, I2S_InitTypeDef* I2S_InitStruct);
void SPI_StructInit(SPI_InitTypeDef* SPI_InitStruct);
void I2S_StructInit(I2S_InitTypeDef* I2S_InitStruct);
void SPI_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState);
void I2S_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState);
void SPI_I2S_ITConfig(SPI_TypeDef* SPIx, u8 SPI_I2S_IT, FunctionalState NewState);
void SPI_I2S_DMACmd(SPI_TypeDef* SPIx, u16 SPI_I2S_DMAReq, FunctionalState NewState);
void SPI_I2S_SendData(SPI_TypeDef* SPIx, u16 Data);
u16 SPI_I2S_ReceiveData(SPI_TypeDef* SPIx);
void SPI_NSSInternalSoftwareConfig(SPI_TypeDef* SPIx, u16 SPI_NSSInternalSoft);
void SPI_SSOutputCmd(SPI_TypeDef* SPIx, FunctionalState NewState);
void SPI_DataSizeConfig(SPI_TypeDef* SPIx, u16 SPI_DataSize);
void SPI_TransmitCRC(SPI_TypeDef* SPIx);
void SPI_CalculateCRC(SPI_TypeDef* SPIx, FunctionalState NewState);
u16 SPI_GetCRC(SPI_TypeDef* SPIx, u8 SPI_CRC);
u16 SPI_GetCRCPolynomial(SPI_TypeDef* SPIx);
void SPI_BiDirectionalLineConfig(SPI_TypeDef* SPIx, u16 SPI_Direction);
FlagStatus SPI_I2S_GetFlagStatus(SPI_TypeDef* SPIx, u16 SPI_I2S_FLAG);
void SPI_I2S_ClearFlag(SPI_TypeDef* SPIx, u16 SPI_I2S_FLAG);
ITStatus SPI_I2S_GetITStatus(SPI_TypeDef* SPIx, u8 SPI_I2S_IT);
void SPI_I2S_ClearITPendingBit(SPI_TypeDef* SPIx, u8 SPI_I2S_IT);



 
#line 98 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_systick.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_systick.h"

 
 
 






 








 










 
 
void SysTick_CLKSourceConfig(u32 SysTick_CLKSource);
void SysTick_SetReload(u32 Reload);
void SysTick_CounterCmd(u32 SysTick_Counter);
void SysTick_ITConfig(FunctionalState NewState);
u32 SysTick_GetCounter(void);
FlagStatus SysTick_GetFlagStatus(u8 SysTick_FLAG);



 
#line 102 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

 

 
typedef struct
{
  u16 TIM_Prescaler;
  u16 TIM_CounterMode;
  u16 TIM_Period;
  u16 TIM_ClockDivision;
  u8 TIM_RepetitionCounter;
} TIM_TimeBaseInitTypeDef;

 
typedef struct
{
  u16 TIM_OCMode;
  u16 TIM_OutputState;
  u16 TIM_OutputNState;
  u16 TIM_Pulse;
  u16 TIM_OCPolarity;
  u16 TIM_OCNPolarity;
  u16 TIM_OCIdleState;
  u16 TIM_OCNIdleState;
} TIM_OCInitTypeDef;

 
typedef struct
{
  u16 TIM_Channel;
  u16 TIM_ICPolarity;
  u16 TIM_ICSelection;
  u16 TIM_ICPrescaler;
  u16 TIM_ICFilter;
} TIM_ICInitTypeDef;

 
typedef struct
{
  u16 TIM_OSSRState;
  u16 TIM_OSSIState;
  u16 TIM_LOCKLevel; 
  u16 TIM_DeadTime;
  u16 TIM_Break;
  u16 TIM_BreakPolarity;
  u16 TIM_AutomaticOutput;
} TIM_BDTRInitTypeDef;

                              

#line 81 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"




#line 91 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

 
#line 99 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

#line 106 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

#line 115 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"
 






 
















 








 












 






 






 






 






 






 






 






 






 





 










 






 






 






 






 






 








 










 
#line 298 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"



#line 308 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

#line 317 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

 
#line 338 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

#line 358 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

 
#line 378 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

#line 397 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

 
#line 406 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"



#line 416 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

 










 
#line 437 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

#line 446 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"






 








 






 






 






  








 
#line 500 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"



#line 510 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

 






 






 





                                     
 






  
#line 548 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

#line 557 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

#line 593 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

 










 






 
#line 625 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

#line 638 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

#line 646 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"

#line 665 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_tim.h"
                                                                                            
 


 


 
 

void TIM_DeInit(TIM_TypeDef* TIMx);
void TIM_TimeBaseInit(TIM_TypeDef* TIMx, TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct);
void TIM_OC1Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct);
void TIM_OC2Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct);
void TIM_OC3Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct);
void TIM_OC4Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct);
void TIM_ICInit(TIM_TypeDef* TIMx, TIM_ICInitTypeDef* TIM_ICInitStruct);
void TIM_PWMIConfig(TIM_TypeDef* TIMx, TIM_ICInitTypeDef* TIM_ICInitStruct);
void TIM_BDTRConfig(TIM_TypeDef* TIMx, TIM_BDTRInitTypeDef *TIM_BDTRInitStruct);
void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct);
void TIM_OCStructInit(TIM_OCInitTypeDef* TIM_OCInitStruct);
void TIM_ICStructInit(TIM_ICInitTypeDef* TIM_ICInitStruct);
void TIM_BDTRStructInit(TIM_BDTRInitTypeDef* TIM_BDTRInitStruct);
void TIM_Cmd(TIM_TypeDef* TIMx, FunctionalState NewState);
void TIM_CtrlPWMOutputs(TIM_TypeDef* TIMx, FunctionalState NewState);
void TIM_ITConfig(TIM_TypeDef* TIMx, u16 TIM_IT, FunctionalState NewState);
void TIM_GenerateEvent(TIM_TypeDef* TIMx, u16 TIM_EventSource);
void TIM_DMAConfig(TIM_TypeDef* TIMx, u16 TIM_DMABase, u16 TIM_DMABurstLength);
void TIM_DMACmd(TIM_TypeDef* TIMx, u16 TIM_DMASource, FunctionalState NewState);
void TIM_InternalClockConfig(TIM_TypeDef* TIMx);
void TIM_ITRxExternalClockConfig(TIM_TypeDef* TIMx, u16 TIM_InputTriggerSource);
void TIM_TIxExternalClockConfig(TIM_TypeDef* TIMx, u16 TIM_TIxExternalCLKSource,
                                u16 TIM_ICPolarity, u16 ICFilter);                                
void TIM_ETRClockMode1Config(TIM_TypeDef* TIMx, u16 TIM_ExtTRGPrescaler, u16 TIM_ExtTRGPolarity,
                             u16 ExtTRGFilter);
void TIM_ETRClockMode2Config(TIM_TypeDef* TIMx, u16 TIM_ExtTRGPrescaler, 
                             u16 TIM_ExtTRGPolarity, u16 ExtTRGFilter);
void TIM_ETRConfig(TIM_TypeDef* TIMx, u16 TIM_ExtTRGPrescaler, u16 TIM_ExtTRGPolarity,
                   u16 ExtTRGFilter);
void TIM_PrescalerConfig(TIM_TypeDef* TIMx, u16 Prescaler, u16 TIM_PSCReloadMode);
void TIM_CounterModeConfig(TIM_TypeDef* TIMx, u16 TIM_CounterMode);
void TIM_SelectInputTrigger(TIM_TypeDef* TIMx, u16 TIM_InputTriggerSource);
void TIM_EncoderInterfaceConfig(TIM_TypeDef* TIMx, u16 TIM_EncoderMode,
                                u16 TIM_IC1Polarity, u16 TIM_IC2Polarity);
void TIM_ForcedOC1Config(TIM_TypeDef* TIMx, u16 TIM_ForcedAction);
void TIM_ForcedOC2Config(TIM_TypeDef* TIMx, u16 TIM_ForcedAction);
void TIM_ForcedOC3Config(TIM_TypeDef* TIMx, u16 TIM_ForcedAction);
void TIM_ForcedOC4Config(TIM_TypeDef* TIMx, u16 TIM_ForcedAction);
void TIM_ARRPreloadConfig(TIM_TypeDef* TIMx, FunctionalState NewState);
void TIM_SelectCOM(TIM_TypeDef* TIMx, FunctionalState NewState);
void TIM_SelectCCDMA(TIM_TypeDef* TIMx, FunctionalState NewState);
void TIM_CCPreloadControl(TIM_TypeDef* TIMx, FunctionalState NewState);
void TIM_OC1PreloadConfig(TIM_TypeDef* TIMx, u16 TIM_OCPreload);
void TIM_OC2PreloadConfig(TIM_TypeDef* TIMx, u16 TIM_OCPreload);
void TIM_OC3PreloadConfig(TIM_TypeDef* TIMx, u16 TIM_OCPreload);
void TIM_OC4PreloadConfig(TIM_TypeDef* TIMx, u16 TIM_OCPreload);
void TIM_OC1FastConfig(TIM_TypeDef* TIMx, u16 TIM_OCFast);
void TIM_OC2FastConfig(TIM_TypeDef* TIMx, u16 TIM_OCFast);
void TIM_OC3FastConfig(TIM_TypeDef* TIMx, u16 TIM_OCFast);
void TIM_OC4FastConfig(TIM_TypeDef* TIMx, u16 TIM_OCFast);
void TIM_ClearOC1Ref(TIM_TypeDef* TIMx, u16 TIM_OCClear);
void TIM_ClearOC2Ref(TIM_TypeDef* TIMx, u16 TIM_OCClear);
void TIM_ClearOC3Ref(TIM_TypeDef* TIMx, u16 TIM_OCClear);
void TIM_ClearOC4Ref(TIM_TypeDef* TIMx, u16 TIM_OCClear);
void TIM_OC1PolarityConfig(TIM_TypeDef* TIMx, u16 TIM_OCPolarity);
void TIM_OC1NPolarityConfig(TIM_TypeDef* TIMx, u16 TIM_OCNPolarity);
void TIM_OC2PolarityConfig(TIM_TypeDef* TIMx, u16 TIM_OCPolarity);
void TIM_OC2NPolarityConfig(TIM_TypeDef* TIMx, u16 TIM_OCNPolarity);
void TIM_OC3PolarityConfig(TIM_TypeDef* TIMx, u16 TIM_OCPolarity);
void TIM_OC3NPolarityConfig(TIM_TypeDef* TIMx, u16 TIM_OCNPolarity);
void TIM_OC4PolarityConfig(TIM_TypeDef* TIMx, u16 TIM_OCPolarity);
void TIM_CCxCmd(TIM_TypeDef* TIMx, u16 TIM_Channel, u16 TIM_CCx);
void TIM_CCxNCmd(TIM_TypeDef* TIMx, u16 TIM_Channel, u16 TIM_CCxN);
void TIM_SelectOCxM(TIM_TypeDef* TIMx, u16 TIM_Channel, u16 TIM_OCMode);
void TIM_UpdateDisableConfig(TIM_TypeDef* TIMx, FunctionalState NewState);
void TIM_UpdateRequestConfig(TIM_TypeDef* TIMx, u16 TIM_UpdateSource);
void TIM_SelectHallSensor(TIM_TypeDef* TIMx, FunctionalState NewState);
void TIM_SelectOnePulseMode(TIM_TypeDef* TIMx, u16 TIM_OPMode);
void TIM_SelectOutputTrigger(TIM_TypeDef* TIMx, u16 TIM_TRGOSource);
void TIM_SelectSlaveMode(TIM_TypeDef* TIMx, u16 TIM_SlaveMode);
void TIM_SelectMasterSlaveMode(TIM_TypeDef* TIMx, u16 TIM_MasterSlaveMode);
void TIM_SetCounter(TIM_TypeDef* TIMx, u16 Counter);
void TIM_SetAutoreload(TIM_TypeDef* TIMx, u16 Autoreload);
void TIM_SetCompare1(TIM_TypeDef* TIMx, u16 Compare1);
void TIM_SetCompare2(TIM_TypeDef* TIMx, u16 Compare2);
void TIM_SetCompare3(TIM_TypeDef* TIMx, u16 Compare3);
void TIM_SetCompare4(TIM_TypeDef* TIMx, u16 Compare4);
void TIM_SetIC1Prescaler(TIM_TypeDef* TIMx, u16 TIM_ICPSC);
void TIM_SetIC2Prescaler(TIM_TypeDef* TIMx, u16 TIM_ICPSC);
void TIM_SetIC3Prescaler(TIM_TypeDef* TIMx, u16 TIM_ICPSC);
void TIM_SetIC4Prescaler(TIM_TypeDef* TIMx, u16 TIM_ICPSC);
void TIM_SetClockDivision(TIM_TypeDef* TIMx, u16 TIM_CKD);
u16 TIM_GetCapture1(TIM_TypeDef* TIMx);
u16 TIM_GetCapture2(TIM_TypeDef* TIMx);
u16 TIM_GetCapture3(TIM_TypeDef* TIMx);
u16 TIM_GetCapture4(TIM_TypeDef* TIMx);
u16 TIM_GetCounter(TIM_TypeDef* TIMx);
u16 TIM_GetPrescaler(TIM_TypeDef* TIMx);
FlagStatus TIM_GetFlagStatus(TIM_TypeDef* TIMx, u16 TIM_FLAG);
void TIM_ClearFlag(TIM_TypeDef* TIMx, u16 TIM_FLAG);
ITStatus TIM_GetITStatus(TIM_TypeDef* TIMx, u16 TIM_IT);
void TIM_ClearITPendingBit(TIM_TypeDef* TIMx, u16 TIM_IT);
                                                                                                             


 








#line 106 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_usart.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_usart.h"

 
 
typedef struct
{
  u32 USART_BaudRate;
  u16 USART_WordLength;
  u16 USART_StopBits;
  u16 USART_Parity;
  u16 USART_Mode;
  u16 USART_HardwareFlowControl;  
} USART_InitTypeDef;

 
typedef struct
{
  u16 USART_Clock;
  u16 USART_CPOL;
  u16 USART_CPHA;
  u16 USART_LastBit;
} USART_ClockInitTypeDef;

 















 


                                    



 









 








 





 















 






 




                               
 




 






 
#line 146 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_usart.h"






















 





 






 







 






 
#line 207 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_usart.h"






                              










 
 
void USART_DeInit(USART_TypeDef* USARTx);
void USART_Init(USART_TypeDef* USARTx, USART_InitTypeDef* USART_InitStruct);
void USART_StructInit(USART_InitTypeDef* USART_InitStruct);
void USART_ClockInit(USART_TypeDef* USARTx, USART_ClockInitTypeDef* USART_ClockInitStruct);
void USART_ClockStructInit(USART_ClockInitTypeDef* USART_ClockInitStruct);
void USART_Cmd(USART_TypeDef* USARTx, FunctionalState NewState);
void USART_ITConfig(USART_TypeDef* USARTx, u16 USART_IT, FunctionalState NewState);
void USART_DMACmd(USART_TypeDef* USARTx, u16 USART_DMAReq, FunctionalState NewState);
void USART_SetAddress(USART_TypeDef* USARTx, u8 USART_Address);
void USART_WakeUpConfig(USART_TypeDef* USARTx, u16 USART_WakeUp);
void USART_ReceiverWakeUpCmd(USART_TypeDef* USARTx, FunctionalState NewState);
void USART_LINBreakDetectLengthConfig(USART_TypeDef* USARTx, u16 USART_LINBreakDetectLength);
void USART_LINCmd(USART_TypeDef* USARTx, FunctionalState NewState);
void USART_SendData(USART_TypeDef* USARTx, u16 Data);
u16 USART_ReceiveData(USART_TypeDef* USARTx);
void USART_SendBreak(USART_TypeDef* USARTx);
void USART_SetGuardTime(USART_TypeDef* USARTx, u8 USART_GuardTime);
void USART_SetPrescaler(USART_TypeDef* USARTx, u8 USART_Prescaler);
void USART_SmartCardCmd(USART_TypeDef* USARTx, FunctionalState NewState);
void USART_SmartCardNACKCmd(USART_TypeDef* USARTx, FunctionalState NewState);
void USART_HalfDuplexCmd(USART_TypeDef* USARTx, FunctionalState NewState);
void USART_IrDAConfig(USART_TypeDef* USARTx, u16 USART_IrDAMode);
void USART_IrDACmd(USART_TypeDef* USARTx, FunctionalState NewState);
FlagStatus USART_GetFlagStatus(USART_TypeDef* USARTx, u16 USART_FLAG);
void USART_ClearFlag(USART_TypeDef* USARTx, u16 USART_FLAG);
ITStatus USART_GetITStatus(USART_TypeDef* USARTx, u16 USART_IT);
void USART_ClearITPendingBit(USART_TypeDef* USARTx, u16 USART_IT);



 
#line 110 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


#line 1 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_wwdg.h"














 

 



 
#line 23 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_wwdg.h"

 
 
 














 
 
void WWDG_DeInit(void);
void WWDG_SetPrescaler(u32 WWDG_Prescaler);
void WWDG_SetWindowValue(u8 WindowValue);
void WWDG_EnableIT(void);
void WWDG_SetCounter(u8 Counter);
void WWDG_Enable(u8 Counter);
FlagStatus WWDG_GetFlagStatus(void);
void WWDG_ClearFlag(void);



 
#line 114 "..\\user\\..\\gtlib\\gtDev\\STM32F10x\\stm32f10x_lib.h"


 
 
 
 
void debug(void);



 
#line 125 "..\\app\\APP\\gtlib.h"
#line 1 "..\\user\\..\\gtlib\\gtDev\\gtDev.h"



#line 5 "..\\user\\..\\gtlib\\gtDev\\gtDev.h"


 
typedef signed char     			S8;
typedef unsigned char   			U8;
typedef short           			S16;
typedef unsigned short  			U16;
typedef int             			S32;
typedef unsigned int    			U32;
typedef long long       			S64;
typedef unsigned long long 			U64;
typedef volatile signed char     	VS8;
typedef volatile unsigned char   	VU8;
typedef volatile short           	VS16;
typedef volatile unsigned short  	VU16;
typedef volatile int             	VS32;
typedef volatile unsigned int    	VU32;
typedef volatile long long       	VS64;
typedef volatile unsigned long long VU64;

typedef unsigned char   			BIT;
typedef unsigned int    			BOOL;

typedef float         				 fp32;                     
typedef double        				 fp64;                     




 											 						
extern int gt_gpio_cfg(U8 xPort,U8 xPin,U8 xMode,U8 sta,U8 xSpeed);					
extern int gt_gpio_set(U8 xPort,U8 xPin,U8 sta);								
extern int gt_gpio_get(U8 xPort,U8 xPin);									
		
extern void gt_us_delay(VU32 T);						
extern void gt_ms_delay(VU32 T);						

extern void gt_def_dint(void);						
extern void gt_def_enit(void);						

extern void gt_dev_init(void);
extern void gt_nvic_reset(void);		




 
extern void gt_io_init(void);				
extern void gt_io_set(U8 nID,U8 sta);	 					
extern U8 gt_io_get(U8 nID);	 						 
extern void gt_digital_play(U8 ucPort,U8 ucPin,U8 ucNum,U8 ucPoint);  

														   


 	
extern void gt_key_init(void);			
extern U32 gt_key_get(void);				



 
extern int gt_vk321x_init(void);			
extern void gt_vk321x_handler(void);
extern void gt_uart_handler(U8 xUart);
extern int gt_getchar(void);					
extern int gt_sendchar(int ch); 		

extern int gt_uart_open(U8 xUart,U32 xBaud,U8 xData,U8 xPari,U8 xStop,U16 rxbufsize,U16 txbufsize);
extern int gt_uart_close(U8 xUart);
extern int gt_uart_send(U8 xUart, const void *pData, int nLen);
extern int gt_uart_rev(U8 xUart, void* pBuf,int size,int nTmo,int ntry);




 
extern int gt_nand_init(void);
extern int gt_nand_readpage(U32 *pPage, void *pBuf, U32 *pDataEcc);
extern int gt_nand_progdata(U32 *pPage, const void *pBuf, U32 *pDataEcc);
extern int gt_nand_proghalfdouble(U32 *pPage, const void *pBuf0, const void *pBuf1, U32 *pDataEcc);
extern int gt_nand_progspare(U32 *pPage, const void *pBuf);
extern int gt_nand_eraseblock(U32 *pPage);




 
extern int gt_norf_init(void);											
extern int gt_norf_erase(U32 adr);									
extern int gt_norf_erasechip(void);								
extern int gt_norf_program(U32 adr, const U32 *pBuf, U32 nLen);	
extern int gt_norf_read(U32 adr, void *pBuf, U32 nLen);				




 




typedef struct
{
	U16 ucLcd_Xmax;
	U16 ucLcd_Ymax;
}gt_lcd_info[1];

extern void gt_lcd_init(void);
extern void gt_lcd_bgl(int nOnOff);						
extern void gt_lcd_drawpoint(int x, int y, U8 color);	
extern void gt_lcd_clearall(U8 color);					
extern void gt_lcd_redraw(void);						
extern void gt_lcd_setBR(char nBr);					
extern void gt_lcd_setPM(U8 nPm);					
extern void gt_lcd_getinfo(gt_lcd_info lcd_info);		




 
extern int gt_i2c_init(U8 p);
extern int gt_i2c_write(U8 nID, U32 nDev, U8 *pData, U32 nLen); 		
extern int gt_i2c_read(U8 nID, U32 nDev, U8 *pData, U32 nLen);				
extern int gt_i2c_writebyte(U8 nID, U32 nDev, U32 nAdr, U32 nData);
extern int gt_eeprom_read(U8 ucID,U8 ucDev_Adr,U32 unAdr,U8 *pData,U8 ucLen);
extern int gt_eeprom_write(U8 ucID,U8 ucDev_Adr,U32 unAdr,U8 *pData,U8 ucLen);




 
extern U8 gt_time_init(void);
extern U8 gt_get_time(time_t *pTime);
extern U8 gt_set_time(time_t tTime);
extern void gt_set_time_callback(time_t old,time_t now);

extern int gt_tim_config(U8 XTIM,U16 XTIM_PRESCALER,U16 XTIM_PERIOD);   



 














 
extern void gt_adc_init(U8 tmi, U16 xtmi_prescaler,U16 xtmi_period,U16 xtmi_pulse);			
extern void gt_adcithandler(void);					
extern void gt_adcithandler_half1(void);			
extern void gt_adcithandler_half2(void);
extern int gt_adc_get(U8 ch,U16 *p,U16 size,int nTmo);		
extern void gt_adc_open(void);				
extern void gt_adc_close(void);
extern void gt_tmi2_change(U16 xtmi_prescaler,U16 xtmi_period,U16 xtmi_pulse);

extern int gt_init_adc_nul(U8 ucID,U8 ucPort,U8 ucPin,U8 ucChannel,U8 ucCycle);
extern U32 gt_get_adc_nul(U8 ucID);



 
extern int gt_spi_init(U8 uID);
extern int gt_spi_config(U8 uID,U32 speed,U8 sckmode,U8 latchmode,U8 ucMode);
extern U8 gt_spi_transmit(U8 uID, U8 nData); 
extern U8 gt_spi_send(U8 uID, const void *psendbuf,int nLen);
extern void gt_spi_it_open(U8 uID);




extern U8 gt_spibus_config(U8 uID,U32 speed,U8 sckmode,U8 latchmode);
extern U8 gt_spibus_send(U8 uID, U8 *nData,U8 ucLen);



extern int gt_pvd_open(U32 level);
extern int gt_pvd_check(void);


extern int gt_ex_irq_config(U8 xPort,U8 xPin, U32 nTriggerMode, void (*handler)(void));




 
extern int gt_att7022_init(void);
extern int gt_att7022_Reset(void);
extern int gt_att7022_writereg(U8 uID, U32 nReg, U32 nData);
extern U32 gt_att7022_readreg(U8 uID, U32 nReg);




 
extern void gt_iwdg_open(void); 		
extern void gt_iwdg_reload(void);		




 	
extern int gt_dm9000_init(void);		
extern U32 gt_dm9000_regread(U32 reg);
extern void gt_dm9000_regwrite(U32 reg, U32 value);
extern int gt_dm9000_reset(void);
extern void gt_dm9000_writecmd(U32 cmd);
extern void gt_dm9000_writedat(U32 dat);
extern U32 gt_dm9000_readdat(void);
extern U32 gt_dm9000_readcmd(void);

extern int gt_eth_init(void);
extern int gt_eth_set(int flag);
extern int gt_eth_send(const unsigned char* buf,int size);
extern void ETH_IRQHandler (void); 


extern void gt_modem_init(void);		
extern void gt_modem_pwer(U8 x);
extern void gt_modem_act(U8 x);
extern void gt_modem_dtr(U8 x);
extern int gt_modem_dcd(void);

extern int gt_modem_step(unsigned int* nDelay);
extern int gt_modem_online(void);
extern int gt_ppp_open(unsigned char** buf,unsigned int* size);
extern int gt_ppp_send(const void* pBuf,int size);
extern int gt_ppp_recv(void* pBuf,int size);




 
extern int mutex_init(void);
extern void mutex_close(int mutex);
extern void mutex_lock(int mutex);
extern void mutex_unlock(int mutex);

extern void tskp_lock(void);
extern void tskp_unlock(void);

extern void tick_sleep(int tick);
extern void ssleep(int sec);
extern void msleep(int ms);



 
void gt_printf(const char *fmt, ...);
long gt_sprintf(char *buf ,const char *format,...);
long gt_snprintf(char *buf, U32 size, const char *fmt, ...);
void gt_printf_ext(const char *fmt, ...);



 
extern void gt_jump_app(U8 xUart);

#line 126 "..\\app\\APP\\gtlib.h"
#line 1 "..\\user\\..\\gtlib\\gtApp\\gtApp.h"





 




#line 1 "..\\app\\APP\\gtlib.h"

#line 195 "..\\app\\APP\\gtlib.h"

#line 12 "..\\user\\..\\gtlib\\gtApp\\gtApp.h"


 
#line 22 "..\\user\\..\\gtlib\\gtApp\\gtApp.h"



 



typedef const struct 
{
	void (*tsk)(void);				
	long long *stk;					
	int size;						
	char prio;						
	unsigned long  time_out;		
}Task_Config;						










 
extern void gt_tsk_deamon(void);









 
extern unsigned long gt_mbx_check(void * mailbox);










 












 
extern void gt_mbx_init(void * mailbox,u16   mbx_size );












 
extern unsigned long gt_mbx_send (void * mailbox,void* message_ptr,u16 timeout);















 
extern unsigned long gt_mbx_wait (void *  mailbox,void** message,u16  timeout);









 
extern void gt_mut_init(void *mutex);










 
extern unsigned long gt_mut_release(void *mutex);












 
extern unsigned long gt_mut_wait (void *mutex, unsigned short timeout);










 
extern void gt_sem_init (void * semaphore,u16 token_count );









 
extern unsigned long gt_sem_send (void * semaphore );












 
extern unsigned long gt_sem_wait (void * semaphore,u16 timeout );










 
extern void gt_evt_clr(unsigned short clear_flags,	unsigned long task_id);









 
extern unsigned short gt_evt_get(void);










 
extern void gt_evt_set(unsigned short event_flags,unsigned long task_id );











 
extern unsigned long  gt_evt_wait_and(unsigned short wait_flags,unsigned short timeout);












 
extern unsigned long  gt_evt_wait_or(unsigned short wait_flags,unsigned short timeout);










 
extern void gt_dly_wait(unsigned short delay);









 
extern void gt_itv_set(unsigned short delay);









 
extern void gt_itv_wait(void);









 
extern void gt_tsk_pass (void);









 
extern unsigned long gt_tsk_id(void);








 
extern void gt_tsk_lock(void);









 
extern void gt_tsk_unlock(void);












 
unsigned long gt_tsk_prio(char id, char prio);












 
unsigned long gt_tsk_prio_self(char prio);










 
char gt_tsk_self(void);











 
extern void gt_local_config(u8 *ip,u8 *mac);










 
extern void gt_net_select(u8 type,u8 soc);










 
extern void gt_remote_config(u8 *ip,u16 *port);











 
extern void gt_gprs_config(u8 *apn,u8 *user,u8 *password);









 
extern void gt_net_start(void);









 
extern void gt_net_stop(void);











 
extern void gt_net_config(int (*log)(),int (*pulse)(),int pulse_set);











 
extern void gt_server_cfg(int (*response)(const u8*,int,const u8**,int*),int type,int port);











 
extern int gt_net_senddata(const void *pData, int nLen);












 
extern int gt_net_recdata(void* pBuf,int size,int nTmo,int ntry);









 
extern int gt_gprs_signal(void);













 
extern int gt_netlog_state(void);















 
int gt_netstate_set(int new_state);





























 
int gt_net_step(void);









 
int gt_localip_get(char *ip);






 
#line 127 "..\\app\\APP\\gtlib.h"
#line 1 "..\\user\\..\\gtlib\\gtfs\\gtfs.h"










int  fs_io_Init(int index);
int  fs_io_format(void (*pCallback)());
int  fs_io_open(const char *name, const char *mode);
int  fs_io_write(const void *buffer,int size,int cnt,int fd);
int  fs_io_read(void *buffer,int size,int cnt,int fd);
int  fs_io_close(int fd);
int  fs_io_seek(int fd,long int offset,int whence);
int  fs_io_mkdir (const char *path);
int  fs_io_rm (const char *path);
int  fs_io_del(const char *path);
int  fs_io_rename (const char *oldpath,const char *newpath);
int  fs_io_list (const char *path);
long fs_io_len (int fd);
long fs_io_size (int fd);
long fs_io_sync (int fd);
int  fs_io_unlink (const char *name);
unsigned int fs_ffind (unsigned char code, unsigned char *buf, unsigned char *mask, unsigned int buflen);
int yaffs_io_close(int fp);


#line 46 "..\\user\\..\\gtlib\\gtfs\\gtfs.h"
	






#line 128 "..\\app\\APP\\gtlib.h"
#line 1 "..\\user\\..\\gtlib\\gtNet\\gtNet.h"
#line 2 "..\\user\\..\\gtlib\\gtNet\\gtNet.h"
#line 3 "..\\user\\..\\gtlib\\gtNet\\gtNet.h"

extern int net_main_cnt;
extern int net_tick_cnt;
extern int net_logic_cnt;
extern int net_server_cnt;


extern volatile int net_gprs_csq;






extern volatile int net_log_ste; 


extern volatile int net_run_step;

void gt_net_init(void);





int gt_net_open(U8 *remip, U16 remport,U16 locport,U8 type,char* dialNum,int timeout);
int gt_net_close(int soc);

int gt_net_state(int soc);

int gt_net_send(int soc, const void *pData, int nLen);
int gt_net_recv(int soc, void* pBuf,int size,int nTmo,int ntry);

void gt_net_mainTsk(void);
void gt_net_tickTsk(void);
void gt_net_logicTsk(void);
void gt_net_serverTsk(void);

void gt_netlog_cfg(int (*login)(),int (*link) (),int timeout);
void gt_netser_cfg(int (*response)(const U8*,int, const U8**,int*),int type,int port);
int gt_netser_send(void* tBuf,int tlen);

void gt_net_synch(char* dns,U8* pIP,U16 remport);

#line 56 "..\\user\\..\\gtlib\\gtNet\\gtNet.h"

int gt_net_set(int nID,void* pDat);
#line 129 "..\\app\\APP\\gtlib.h"
#line 1 "..\\user\\..\\gtlib\\gtUi\\gtui.h"




 





extern const  int  GUI_HZK_TYPE	;


extern const  int  GUI_HZK_BASE ;






extern const struct MenuItem MainMenu[];


extern const  int  DISP_TIME;		 
extern const  int  MENU_TIME;		 

extern const  int  GUI_HEAD_WIDTH  ;
extern const  int  GUI_LAST_WIDTH  ;


extern  const  int LCD_X_MAX ;
extern  const  int LCD_Y_MAX ;

extern const  int  GUI_HZK_TYPE	;

extern int GUI_ASC_WIDTH; 		  
extern int GUI_HZ_WIDTH; 		 
extern int GUI_HZ_HEIGHT;		
extern int GUI_HZ_SIZE;  


extern const  int  DISP_MAX_ROW  ;


extern const  int  DISP_ROW_SPACE;


extern const  int  DISP_START_X;


extern const  int  DISP_START_Y;


extern const  int  BG_TIME;

extern const  int  BACK_TO_LXTIME;

extern const  int  BACK_TO_MAINTIME;

extern const  int  LX_BACK_TIME;



extern const struct MenuItem *MenuPoint;





void disp_head(void);		  
void show_loopdisp(int);	  
void gui_set_time(unsigned long tTime);	  
unsigned gui_get_time(void);			  


typedef unsigned int		uint;
typedef signed char			sint8;
typedef unsigned char		uint8;
typedef short				sint16;
typedef unsigned short		uint16;
typedef int					sint32;
typedef unsigned int		uint32;
typedef long long			sint64;
typedef unsigned long long	uint64;
typedef unsigned char		bit;
typedef uint32				t_adr;
typedef int					t_color;

typedef const struct {
	uint nValue;		  
	const char *str;	  
}t_gui_spec_editor, *p_gui_spec_editor;


typedef  struct {
	uint16   ID;	  
	uint8 	 len;	  
}SysPa;


typedef union dataunion
{
	char 	strtmp[32];
	uint8 	u8tmp[8];
	uint32  u32tmp;
	uint32  u32temp[2];
	uint64	u64tmp;
}datatype;

typedef   unsigned char(*pExecFunDef)(datatype *pdata,int sel);	   
typedef   unsigned char(*pdisplay)(datatype *pdata,int sel,char change);	   
typedef   unsigned char(*pdisplays)(datatype *pdata,int sel,char change,uint8 nextpage);	
typedef struct
{
	uint16 mNum:8;				 
	uint16 reflash:4;			 
	pExecFunDef	funInit;		 
	pdisplays	funShow;		 
	pExecFunDef	funExec[32];     
}idxFunSts;

typedef struct
{
	uint16 mNum:8;				 
	uint16 reflash:4;			 
	pExecFunDef	funInit;		 
	pdisplay	funShow;		 
	pExecFunDef	funExec[32];     
}idxFunSt;



struct MenuItem
{
	unsigned char MenuCount; 
	unsigned char *p_reti;      
	unsigned char *DisplayString; 
	unsigned char (*Subs)(void *p); 
	void  *data;                                       
	const struct MenuItem *ChildrenMenus; 
	const struct MenuItem *ParentMenus; 
};






extern const struct MenuItem ProjectMenu[];


extern const  int  GUI_KEY_TYPE	;

extern const  int  GUI_LOCK_KEY	;

extern   int  GUI_LOCK_KEY_STATE;

extern const  int  GUI_LOCK_TIME ;


extern const  int KEY_CODE_UP	;		
extern const  int KEY_CODE_DOWN	;		
extern const  int KEY_CODE_LEFT ;   	
extern const  int KEY_CODE_RIGHT ; 		
extern const  int KEY_CODE_ESC	;		
extern const  int KEY_CODE_ENT	; 		
extern const  int KEY_CODE_LOCK ;		

extern int GUI_PRJ_KEY_NUM;

extern const unsigned char GUI_PRJ_KEY[];












int sprintf(char * __restrict  , const char * __restrict  , ...) __attribute__((__nonnull__(1,2)));









 
void gui_Init(void);













 
void gui_DrawLine(int x0, int y0, int x1, int y1, t_color color);				












 
void gui_DrawHLine(int x0, int y0, int x1, t_color color);












 
void gui_DrawRLine(int x0, int y0, int y1, t_color color);













 
void gui_DrawRect_Hol(int x1, int y1, int x2, int y2, t_color color);		













 
void gui_DrawRect_Fill(int x1, int y1, int x2, int y2, t_color color);			













 
void gui_DrawIcon_Mono(int x1, int y1, int x2, int y2, const unsigned char *p);









 
void gui_DrawBMP_Mono(unsigned char *p);













 
void gui_DrawString_ASC6x12(int x, int y, char *pStr, t_color nColor);  












 
void gui_DrawString_ASC6x8(int x, int y, char *pStr, t_color nColor); 












 
int gui_DrawString_Mixed(int x, int y, char *pStr, t_color nColor);     












 
void gui_DrawChar_HZ(int x, int y, char *pStr, t_color nColor);	        









 
int gui_GetStringWidth(char *pStr);	













 									
int gui_DrawString_Mixed_Align(int x, int y, char *pStr, t_color nColor, int nAlignType);         











 
void disp_SingleData_align(uint8 nRow, char *pData, int align_type);	












 
void disp_single_data(uint8 nRow, char *pItem, char *pData, t_color n_color); 












 
uint16 cycle(uint n, uint nStart, uint nEnd, int nStepping);











 
uint8 Get_NemuType(t_gui_spec_editor *p,uint n,uint j);












 
void gui_Editor_NumberCreate(char *pStr, uint64 nNum, uint nBits, int nBcd);










 
void gui_Editor_IPAddressCreate(char *pStr, uint8 *pIP);









 
unsigned char  Waitforkey(uint32 *ptmp);









 
unsigned char MenuExec(void *para);











 
unsigned char Set_Nemutype(datatype *pdata,t_gui_spec_editor *pitem,uint n);










 
unsigned char Edit_String(datatype *p,int num_bitAT);










 
unsigned char Edit_add(datatype *p,int num_bitAT);










 
unsigned char Set_IPAdr(datatype *p,int sel);











 
unsigned char Set_nBits(datatype *p,unsigned char bit,int nBCD);









 
unsigned char SetCurrentTime(void);











 
unsigned char Set_nNums2(datatype *p,unsigned char nArr,unsigned char ndata);










 
unsigned char Set_nNums(datatype *p,unsigned char nArr,unsigned char flag);











 
unsigned char Set_nNums3(datatype *p,unsigned char nArr,uint nBcd);










 
unsigned char Set_nNums4(datatype *p,unsigned char nArr);









 
void SetDispFlag(void);








 

#line 625 "..\\user\\..\\gtlib\\gtUi\\gtui.h"
#line 626 "..\\user\\..\\gtlib\\gtUi\\gtui.h"
#line 627 "..\\user\\..\\gtlib\\gtUi\\gtui.h"
#line 1 "..\\user\\..\\gtlib\\gtNet\\gtNet.h"
#line 2 "..\\user\\..\\gtlib\\gtNet\\gtNet.h"
#line 3 "..\\user\\..\\gtlib\\gtNet\\gtNet.h"

extern int net_main_cnt;
extern int net_tick_cnt;
extern int net_logic_cnt;
extern int net_server_cnt;


extern volatile int net_gprs_csq;






extern volatile int net_log_ste; 


extern volatile int net_run_step;

void gt_net_init(void);





int gt_net_open(U8 *remip, U16 remport,U16 locport,U8 type,char* dialNum,int timeout);
int gt_net_close(int soc);

int gt_net_state(int soc);

int gt_net_send(int soc, const void *pData, int nLen);
int gt_net_recv(int soc, void* pBuf,int size,int nTmo,int ntry);

void gt_net_mainTsk(void);
void gt_net_tickTsk(void);
void gt_net_logicTsk(void);
void gt_net_serverTsk(void);

void gt_netlog_cfg(int (*login)(),int (*link) (),int timeout);
void gt_netser_cfg(int (*response)(const U8*,int, const U8**,int*),int type,int port);
int gt_netser_send(void* tBuf,int tlen);

void gt_net_synch(char* dns,U8* pIP,U16 remport);

#line 56 "..\\user\\..\\gtlib\\gtNet\\gtNet.h"

int gt_net_set(int nID,void* pDat);
#line 628 "..\\user\\..\\gtlib\\gtUi\\gtui.h"
#line 1 "..\\user\\..\\gtlib\\gtUi\\gtui.h"
#line 629 "..\\user\\..\\gtlib\\gtUi\\gtui.h"
#line 630 "..\\user\\..\\gtlib\\gtUi\\gtui.h"

uint8   bcd2bin8(uint8  x);
uint8   bin2bcd8(uint8  x);
uint16 bin2bcd16(uint16 x);
uint16 bcd2bin16(uint16 x);
uint32 bin2bcd32(uint32 x);
uint32 bcd2bin32(uint32 x);
uint64 bin2bcd64(uint64 x);
uint64 bcd2bin64(uint64 x);

#line 648 "..\\user\\..\\gtlib\\gtUi\\gtui.h"

void TimeToBcd(U32 time, uint8 *dst);













 


#line 130 "..\\app\\APP\\gtlib.h"
#line 1 "..\\user\\..\\gtlib\\gtUi\\guiGetFont.h"







#line 9 "..\\user\\..\\gtlib\\gtUi\\guiGetFont.h"
#line 10 "..\\user\\..\\gtlib\\gtUi\\guiGetFont.h"
#line 11 "..\\user\\..\\gtlib\\gtUi\\guiGetFont.h"

extern U32 debugMark;


typedef struct
{
	U32 offset;
	U8 state;
	U8 data[32];

}font_buff_type;

extern int GUI_fp;	
extern const char* FontFileName;



extern int FontFile_mute;
extern void FontFile_initlock();
extern void FontFile_lock() ;
extern void FontFile_unlock() ;





int FontFileOpen();

void FontFileClose();






extern int GetFont(int pOffset , void *OutBuffer, char *font, int change);



extern void InitFont();



extern void CloseFont();





#line 131 "..\\app\\APP\\gtlib.h"
#line 132 "..\\app\\APP\\gtlib.h"

uint8   bcd2bin8(uint8  x);
uint8   bin2bcd8(uint8  x);
uint16 bin2bcd16(uint16 x);
uint16 bcd2bin16(uint16 x);
uint32 bin2bcd32(uint32 x);
uint32 bcd2bin32(uint32 x);
uint64 bin2bcd64(uint64 x);
uint64 bcd2bin64(uint64 x);

#line 150 "..\\app\\APP\\gtlib.h"

void TimeToBcd(U32 time, uint8 *dst);












extern void msg_trace(uint8* pDat,int len);















 

extern int ArrayBitSet(U8*buffer,int len,int index,U8 value);
extern int ArrayBitGet(U8*buffer,int len,int index);


extern int GMTToTime(const char* gmt,const U32 zone);




 




#line 6 "..\\app\\gt_alarm\\gt_event.c"
#line 7 "..\\app\\gt_alarm\\gt_event.c"
#line 8 "..\\app\\gt_alarm\\gt_event.c"
#line 1 "..\\app\\gt_alarm\\gt_event_int.h"



 



#line 1 "..\\app\\APP\\store.h"








#line 10 "..\\app\\APP\\store.h"



typedef struct
{
	uint32 di;          
	uint16 group;		
	uint16 size;		
	uint16 offset;		
	uint16 ver_code;	
	uint8  save_type;	
	uint8  gat;         
	uint8* pVal;		
	uint8  r;
	uint8  w;
	uint8  rsv[6];		
}t_sysTable;






int gt_para_getIndex(U32 sno,U32 di,t_sysTable* pIdx);
int gt_para_process (U32 sno,U32 di,U8* pbuf,int len,U8 rw,U8 force);
int gt_grup_process (U32 sno,U32 di,U8 gat,U8* pbuf,int len,U8 rw,U8 force);
int gt_data_save(U8 force);
int gt_data_free(void);
void gt_store_init(void);


int gt_data_getIndex(U32 sno,U8 type,U32 di,t_sysTable* pIdx);
int gt_data_process (U32 sno,U8 type,U32 tn,U32 di,U8* pbuf,int len,U8 rw,U8 force);
int gt_dgrup_process (U32 sno,U8 type,U32 tn,U32 di,U8 gat,U8* pbuf,int len,U8 rw,U8 force);



#line 9 "..\\app\\gt_alarm\\gt_event_int.h"

typedef struct 
{
	U32 code;				
	U32 data;
}event_type;



















 




































extern const event_type event_list[];	

extern void *gt_malloc(int size);
extern void gt_free(void *p);
extern void *gt_realloc(void *p, int size);









 


#line 9 "..\\app\\gt_alarm\\gt_event.c"
#line 1 "..\\app\\gt_alarm\\gt_event_cfg.h"



 
















 
#line 10 "..\\app\\gt_alarm\\gt_event.c"
#line 1 "..\\app\\gt_alarm\\gt_event_item.c"



 
#line 6 "..\\app\\gt_alarm\\gt_event_item.c"
#line 7 "..\\app\\gt_alarm\\gt_event_item.c"
#line 8 "..\\app\\gt_alarm\\gt_event_item.c"
#line 1 "..\\app\\gt_alarm\\gt_event.h"



 
#line 115 "..\\app\\gt_alarm\\gt_event.h"





 


#line 9 "..\\app\\gt_alarm\\gt_event_item.c"
#line 10 "..\\app\\gt_alarm\\gt_event_item.c"
#line 1 "..\\app\\gt_alarm\\gt_event_cfg.h"



 
















 
#line 11 "..\\app\\gt_alarm\\gt_event_item.c"


 







const U32 erd3[4] = 
{
	0X00010000,	0X00020000, 0X00030000,	0X00040000
};

const U32 erd5[8] = 
{
	0xE1000101,	0xE1000102, 0xE1000103,	0xE1000104, 
	0xE1000105,	0xE100010D, 0xE100010E, 0xE100010F,
};


const U32 erd9[2] = 
{
	0X00010000,	0X00020000,
};




 









 
int EvLossVAS(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE2010004, tn, 1);
}










 
int EvLossVAE(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE2010004, tn, 0);	
}










 
int EvLossVBS(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE2010005, tn, 1);
}










 
int EvLossVBE(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE2010005, tn, 0);	
}











 
int EvLossVCS(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE2010006, tn, 1);
}










 
int EvLossVCE(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE2010006, tn, 0);	
}












 
int EvLossCAS(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE2010007, tn, 1);
}










 
int EvLossCAE(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE2010007, tn, 0);	
}











 
int EvLossCBS(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE2010008, tn, 1);
}










 
int EvLossCBE(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE2010008, tn, 0);	
}











 
int EvLossCCS(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE2010009, tn, 1);
}










 
int EvLossCCE(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE2010009, tn, 0);	
}












 
int EvPhaseAS(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE201000B, tn, 1);
}










 
int EvPhaseAE(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE201000B, tn, 0);	
}












 
int EvPhaseBS(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE201000C, tn, 1);
}










 
int EvPhaseBE(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE201000C, tn, 0);	
}











 
int EvPhaseCS(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE201000D, tn, 1);
}










 
int EvPhaseCE(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE201000D, tn, 0);	
}











 
int EvNeedClr(U16 tn, U32 type)
{
	U8 buff[6];
	
	if (type != 1)
		return 0;
	
	TimeToBcd(time(0), buff);	
	gt_event_write(0xE2010003, tn, buff, 6);
}












 
int EvOpen1(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE2010011, tn, 1);	
}










 
int EvOpen2(U16 tn, U32 type)
{
	if (type != 1)
		return 0;
	return gt_event_save(0xE2010012, tn, 1);	
}




 
const event_type event_list[21] = 
{
	0xE2010001,	1,		
	0xE2010002,	2,		
	0xE2010003,	2,		
	0xE2010004,	3,		
	0xE2010005,	3,		
	0xE2010006,	3,		
	0xE2010007,	3,		
	0xE2010008,	3,		
	0xE2010009,	3,			
	0xE201000A, 4,		
	0xE201000B,	3,		
	0xE201000C,	3,		
	0xE201000D,	3,		
	0xE201000E,	6,		
	0xE201000F,	3,		
	0xE2010010,	9,		
	0xE2010011,	3,		
	0xE2010012,	3,		
	0xE2010013,	7,		
	0xE2010014,	8,		
	0xE2010015,	3,		
};








 


#line 11 "..\\app\\gt_alarm\\gt_event.c"


 






















#pragma arm section rwdata = "SRAM",zidata = "SRAM"	 


static U8 event_new_index_buff[7 * 200];
static U8 event_old_index_buff[7 * 200];

static U8 event_new_data_buff[(1500 + 64)];
#pragma arm section






volatile static U8 event_file_lock = 0;				








static U8 bin2bcd8(U8 x)
{

	return ((x / 10) << 4) + x % 10;
}






void TimeToBcd(U32 time, uint8 *dst)
{
	struct tm t;
	char *p = dst;
	
	localtime_r(&time, &t);
	*p++ = bin2bcd8(t.tm_sec);
	*p++ = bin2bcd8(t.tm_min);
	*p++ = bin2bcd8(t.tm_hour);
	*p++ = bin2bcd8(t.tm_mday);
	*p++ = bin2bcd8(t.tm_mon + 1);
	*p++ = bin2bcd8(t.tm_year - 100);
}





static const U64 math_pow10[] = {
	1,
	10,
	100,
	1000,
	10000,
	100000,
	1000000,
	10000000,
	100000000,
	1000000000,
	10000000000,
	100000000000,
	1000000000000,
	10000000000000,
	100000000000000,
	1000000000000000,
};






static U32 bin2bcd32(U32 x)
{
	int i;
	char str[10 + 1];
	U8 bcd[4 + 1];

	sprintf(str, "%10ld", x);
	for (i = 0;  i < 5;  i++)
		bcd[4 - i] = ((str[2 * i] & 0x0F) << 4) | (str[2 * i + 1] & 0x0F);
	memcpy(&i, bcd, sizeof(i));
	return i;
}




static U32 bcd2bin32(U32 x)
{
	int i, y = 0, nTemp;
	U8 *p = (U8 *)&x;

	for (i = 0; i < 4; ++i) {
		nTemp = p[i];
		y += ((U32)(nTemp & 0x0F) * (U32)math_pow10[i * 2]);
		y += ((U32)((nTemp >> 4) & 0x0F) * (U32)math_pow10[i * 2 + 1]);
	}
	return y;
}









 
static int EventFileLock(int tick)
{
	while (tick--)
	{
		gt_tsk_lock();
		if (event_file_lock == 0)
		{
			event_file_lock = 1;
			gt_tsk_unlock();
			return 1;
		}
		gt_tsk_unlock();
		gt_dly_wait(1);
	}

	gt_printf("\nlock event file fail");

	return 0;
}










 
static int EventFileUnlock()
{
	gt_tsk_lock();
	event_file_lock = 0;
	gt_tsk_unlock();
	return 1;
}










 
static int ChkEventValid(U32 code)
{
	U8 mask[32];

	if (code < 0xE2010001 || code > 0xE20100FF)
		return 0;
	if (gt_para_process(0, 0xE0000152, mask, 32, 'r', 0) != 32)
		return 0;
	if ((mask[(code - 0xE2010001) / 8] & (1 << ((code - 0xE2010001) % 8))) != 0)
		return 1;
	return 0;
}













 
static int UpdateIndex(int fp_new, int fp_old, char *new_file_name)
{

	int read_len, tn_num;
	int new_data_offset, index_offset;
	U16 event_data_len;
	U8 *new_index_buff = 0, *old_index_buff = 0;
	int index_total_len, i, temp;
	int ret = 0;	

	read_len = 7 * 200;	

	new_index_buff = event_new_index_buff;
	old_index_buff = event_old_index_buff;
#line 249 "..\\app\\gt_alarm\\gt_event.c"
	tn_num = 11;

	index_total_len = tn_num * 21 * 10 * 7;
	index_offset = 32;
	new_data_offset = index_total_len + index_offset;
	
	while (index_total_len > 0)
	{
		if (index_total_len > 7 * 200)
		{
			read_len = 7 * 200;
			index_total_len -= read_len;
		}
		else
		{
			read_len = index_total_len;
			index_total_len = 0;
		}
		temp = read_len;		
		if (yaffs_io_seek(fp_old, index_offset, 0) != 0)
		{

			gt_printf("\nupdate index e1");

			goto err;
		}
		if (fs_io_read(old_index_buff, 1, read_len, fp_old) != read_len)
		{

			gt_printf("\nupdate index e2");

			goto err;
		}
		i = 0;
		while (read_len)
		{
			read_len -= 7;
			memcpy(&event_data_len, old_index_buff + i * 7 + 3, 2);
			if (event_data_len == 0)
			{
				memset(new_index_buff+ i * 7, 0, 7);
			}
			else
			{
				if (event_data_len > 0x4000)
				{

					gt_printf("\nupdate index e3");

					goto err;
				}
				memcpy(new_index_buff+ i * 7, &new_data_offset, 3);
				memcpy(new_index_buff+ i * 7 + 3, &event_data_len, 2);
				new_data_offset += event_data_len;
			}
			i++;
		}
		if (yaffs_io_seek(fp_new, index_offset, 0) != 0)
		{

			gt_printf("\nupdate index e4");

			goto err;	
		}
		if (fs_io_write(new_index_buff, 1, temp, fp_new) != temp)
		{

			gt_printf("\nupdate index e5");

			goto err;
		}
		if (yaffs_io_close(fp_new) != 0)
		{

			gt_printf("\nupdate index e6");

			goto err;
		}		
		fp_new = yaffs_io_open(new_file_name, "r+");
		if (fp_new == 0)
		{

			gt_printf("\nupdate index e7");

			goto err;
		}		
		
		index_offset += temp;
	}
	
	if (index_total_len == 0)
		ret = 1;
	
err:
#line 349 "..\\app\\gt_alarm\\gt_event.c"
	return ret;
}












 
static int UpdateData(int fp_new, int fp_old, char *new_file_name)
{
	U8 *new_data_buff = 0, *index_buff = 0;
	U32 new_data_buff_len, new_data_len, old_event_data_addr;
	U16 event_data_len;
	int ret = 0;
	U32 index_offset, index_buff_len, index_total_len, read_len, index_num;
	U32 new_event_data_addr;
	char finish = 0, write = 0;
	
	index_buff_len = 200 * 7;

	new_data_buff_len = (1500 + 64);		
	index_buff = event_new_index_buff;
	new_data_buff = event_new_data_buff;
#line 398 "..\\app\\gt_alarm\\gt_event.c"
	index_total_len = 11 * 21 * 10 * 7;
	index_offset = 32;
	new_event_data_addr = index_offset + index_total_len;
	read_len = 0;
	new_data_len = 0;
	index_num = 0;
	old_event_data_addr = 0;
	while (finish == 0)		
	{
		if (index_num * 7 >= read_len)
		{
			if (index_total_len >= index_buff_len)
			{
				read_len = index_buff_len;
				index_total_len -= read_len;
			}
			else
			{
				read_len = index_total_len;
				index_total_len = 0;
			}
			if (yaffs_io_seek(fp_old, index_offset, 0) != 0)
			{

				gt_printf("\nupdate data e3");

				goto err;
			}
			if (fs_io_read(index_buff, 1, read_len, fp_old) != read_len)
			{

				gt_printf("\nupdate data e4");

				goto err;
			}		
			index_offset += read_len;
			index_num = 0;			
		}

		while (new_data_len < new_data_buff_len)
		{
			if (index_num * 7 >= read_len)
				break;
			memcpy(&event_data_len, index_buff + index_num * 7 + 3, 2);
			if (event_data_len == 0)
			{
				index_num++;
				continue;
			}
			if ((new_data_len + event_data_len) > new_data_buff_len) 
			{

				write = 1;
				break;
#line 470 "..\\app\\gt_alarm\\gt_event.c"
			}
			memcpy(&old_event_data_addr, index_buff + index_num * 7, 3);
			if (yaffs_io_seek(fp_old, old_event_data_addr, 0) != 0)
			{

				gt_printf("\nupdate data e6");

				goto err;
			}
			if (fs_io_read(&new_data_buff[new_data_len], 1, event_data_len, fp_old) != event_data_len)
			{

				gt_printf("\nupdate data e8");

				goto err;
			}				
			new_data_len += event_data_len;
			index_num++;
		}
		
		if ((index_total_len == 0) && (index_num * 7 >= read_len))
		{
			if (new_data_len > 0)
				write = 1;
			finish = 1;
		}
		
		if ((new_data_len >= new_data_buff_len) || (write == 1))			
		{
			write = 0;
			if (yaffs_io_seek(fp_new, new_event_data_addr, 0) != 0)
			{

				gt_printf("\nupdate data e9");

				goto err;
			}
			if (fs_io_write(new_data_buff, 1, new_data_len, fp_new) != new_data_len)
			{

				gt_printf("\nupdate data e10");

				goto err;
			}	
			if (yaffs_io_close(fp_new) != 0)
			{

				gt_printf("\nupdate data e11");

				goto err;				
			}
			fp_new = yaffs_io_open(new_file_name, "r+");
			if (fp_new == 0)
			{

				gt_printf("\nupdate data e12");

				goto err;				
			}			
			new_event_data_addr += new_data_len;
			new_data_len = 0;
		}
		





		if (finish == 1)
			ret = 1;
	}
	
err:
#line 549 "..\\app\\gt_alarm\\gt_event.c"
	return ret;
}











 
static int ChkEventDataFile(char *event_info, int fp)
{
	int fp_old = fp, fp_new = 0;
	int size;
	char *new_index_buff = 0; 
	char new_file_name[30];
	int ret = 0;
	
	size = fs_io_size(fp_old);
	if (size < (60 * 1024))
		return 1;

	gt_printf("\nchange event file ");

	
	if (event_info[0] == 0)
		strcpy(new_file_name, "Event1.bin");
	else
		strcpy(new_file_name, "Event0.bin");
	fp_new = yaffs_io_open(new_file_name, "w");
	if (fp_new == 0)
	{

		gt_printf("\nchk event e1(%s)",new_file_name);

		return 0;
	}
	if (fs_io_write(new_index_buff, 1, 32, fp_new) != 32)
	{

		gt_printf("\nchk event e2 ");

		goto err;
	}
	if (yaffs_io_close(fp_new) != 0)
	{

		gt_printf("\nchk event e3");

		goto err;
	}
	fp_new = yaffs_io_open(new_file_name, "r+");
	if (fp_new == 0)
	{

		gt_printf("\nchk event e4");

		return 0;
	}
	if (UpdateIndex(fp_new, fp_old, new_file_name) != 1)
		goto err;
	if (UpdateData(fp_new, fp_old, new_file_name) != 1)
		goto err;	
	
	if (event_info[0] == 0)		
	{
		event_info[1] = 0;
		event_info[2] = 1;
		event_info[0] = 1;
	}
	else
	{
		event_info[1] = 1;
		event_info[2] = 0;
		event_info[0] = 0;
	}
	fp = fp_new;
	yaffs_io_close(fp_old);

	gt_printf("\nok ");

	return 1;
	
err:	
	yaffs_io_close(fp_new);
	return ret;
}










 
static int InitEventFile()
{

	int fp = 0;
	U32 data_file_size, len, tn_num;
	U8 *index_buff = 0;
	int ret = 0;
	



	tn_num = 11;

	data_file_size = 32 + tn_num * 21 * 10 * 7;

	index_buff = event_new_index_buff;
#line 675 "..\\app\\gt_alarm\\gt_event.c"
	memset(index_buff, 0, (7 * 200));
	
	fp = yaffs_io_open("Event0.bin", "w");
	if (fp == 0)
	{

		gt_printf("\ninit event e1 ");

		goto err;
	}
	while (data_file_size > 0)
	{
		if (data_file_size > (7 * 200))
		{
			len = (7 * 200);
			data_file_size -= (7 * 200);
		}
		else
		{
			len = data_file_size;
			data_file_size = 0;			
		}
		if (fs_io_write(index_buff, 1, len, fp) != len)
		{
			

			gt_printf("\ninit event e2 ");

			goto err;
		}
	}
	
	if (yaffs_io_close(fp) != 0)
	{

		gt_printf("\nclose event index fail");

		goto err;
	}
	
	
	fp = yaffs_io_open("EventInfo.bin", "w");
	if (fp == 0)
	{

		gt_printf("\ninit event e3 ");

		goto err;
	}
	memset(index_buff, 0, (16));
	if (fs_io_write(index_buff, 1, (16), fp) != (16))
	{

		gt_printf("\ninit event e4 ");

		goto err;
	}	
	if (yaffs_io_close(fp) != 0)
	{

		gt_printf("\nclose event index fail");

		goto err;
	}
	fp = 0;
	ret = 1;

	gt_printf("\ninit event ok");

err:
	if (fp != 0)
		yaffs_io_close(fp);



	return ret;

}

















 
int gt_event_write(U32 code, U16 tn, void *src, U32 src_len, U32 new_record)
{
	int fp_info = 0, fp_data = 0;
	U32 index_len, seq, index_tn;
	int ret = 0, index_offset, event_data_addr;
	char data_file[30];
	char event_info[(16)];
	U8 index_buff[7 * 10];
	U8 *dst = event_new_data_buff;
	
	if (src_len > 1500)
		return 0;
	if (ChkEventValid(code) != 1)
		return 0;
	for (seq = 0; seq < 21; seq++)
	{
		if (event_list[seq].code == code)
			break;
	}
	if (seq >= 21)
		return 0;
	
	index_offset = time(0);
	memcpy(dst, &code, 4);
	memcpy(dst + 4, &tn, 2);
	memcpy(dst + 6, &src_len, 2);
	memcpy(dst + 8, &index_offset, 4);
	memcpy(dst + 16, src, src_len);
	src_len += 16;

	gt_printf("\nsave event %X, tn %d", code, tn);

	if (EventFileLock(200) != 1)
		return 0;
	fp_info = yaffs_io_open("EventInfo.bin", "r+");
	if (fp_info == 0)
	{

		gt_printf("\nsave event e1 ");

		goto save_event_err;
	}
	if (fs_io_read(event_info, 1, (16), fp_info) != (16))
	{	

		gt_printf("\nsave event e2 ");

		goto save_event_err;
	}
	
	
	if (event_info[0] == 0)
		strcpy(data_file, "Event0.bin");
	else
		strcpy(data_file, "Event1.bin");
	
	fp_data = yaffs_io_open(data_file, "r+");
	if (fp_data == 0)
	{

		gt_printf("\nsave event e3 ");

		goto save_event_err;
	}
	else
	{
		
		if (ChkEventDataFile(event_info, fp_data) != 1)
		{

			gt_printf("\nchange event file fail");

			goto save_event_err;
		}
	}
	
	
	index_tn = tn;	




	index_len = 7 * 10;	
	index_offset = 32 + (21 * 10 * index_tn  + seq * 10) * 7;
	if (yaffs_io_seek(fp_data, index_offset, 0) != 0)
	{

		gt_printf("\nsave event e4 ");

		goto save_event_err;
	}	
	if (fs_io_read(index_buff, 1, index_len, fp_data) != index_len)
	{

		gt_printf("\nsave event e5 ");

		goto save_event_err;
	}
	
	event_data_addr = fs_io_size(fp_data);
	if (event_data_addr == -1)
	{

		gt_printf("\nsave event e6 ");

		goto save_event_err;
	}
	if (yaffs_io_seek(fp_data, event_data_addr, 0) != 0)
	{

		gt_printf("\nsave event e7 ");

		goto save_event_err;
	}
	if (fs_io_write(dst, 1, src_len, fp_data) != src_len)
	{

		gt_printf("\nsave event e8 ");

		goto save_event_err;
	}

	
	
	if (yaffs_io_close(fp_data) != 0)
	{

		gt_printf("\nsave event e9 ");

		goto save_event_err;
	}
	if (event_info[0] == 0)
		strcpy(data_file, "Event0.bin");
	else
		strcpy(data_file, "Event1.bin");
	fp_data = yaffs_io_open(data_file, "r+");
	if (fp_data == 0)
	{

		gt_printf("\nsave event e10 ");

		goto save_event_err;
	}
	
	if (new_record == 1)						
		memmove(index_buff + 7, index_buff, 7 * (10 - 1));
	memcpy(index_buff, &event_data_addr, 3);
	memcpy(index_buff + 3, &src_len, 2);
	memcpy(index_buff + 3 + 2, &tn, 2);
	
	if (yaffs_io_seek(fp_data, index_offset, 0) != 0)
	{

		gt_printf("\nsave event e11 ");

		goto save_event_err;
	}	
	if (new_record == 0)
		index_len = 7;
	if (fs_io_write(index_buff, 1, index_len, fp_data) != index_len)
	{

		gt_printf("\nsave event e12 ");

		goto save_event_err;
	}	

	gt_printf("\naddr: %X len: %X", event_data_addr, src_len);

	ret = 1;		
	
save_event_err:	
	if (fp_info != 0)
		yaffs_io_close(fp_info);
	if (fp_data != 0)
		yaffs_io_close(fp_data);
	EventFileUnlock();

	if (ret == 1)
		gt_printf("\nsave event ok ");
	else
		gt_printf("\nsave event fail ");

	return ret;	
}













 
int gt_event_save(U32 code, U16 tn, U32 new_record)
{

	t_sysTable info;
	U32 seq, i, len;
	U32 *id_list, id_num;
	U32 data, temp;
	char buff[200];
	
	if (ChkEventValid(code) != 1)
		return 0;
	for (seq = 0; seq < 21; seq++)
	{
		if (event_list[seq].code == code)
			break;
	}
	if (seq >= 21)
		return 0;
	
	switch (event_list[seq].data)
	{
		case 3:
			id_list = (U32 *)erd3;
			id_num = 4;
			break;
		case 4:
			id_list = 0;
			id_num = 0;
			break;			
		case 5:
			id_list = (U32 *)erd5;
			id_num = 8;
			break;					
		case 9:
			if (new_record == 0)
				return 0;
			id_list = (U32 *)erd9;
			id_num = 2;
			break;				
		default:
			return 0;
	}
	
	
	if (new_record == 1)
	{
		TimeToBcd(time(0), buff);
		memset(buff + 6, 0xFF, 6);
		len = 12;
		for (i = 0; i < id_num; i++)
		{
			if (gt_para_getIndex(tn, id_list[i], &info)  != 1)
				continue;
			gt_para_process(tn, id_list[i], (U8 *)buff + len, info . size, 'r', 0);
			len += info.size;
		}
	}
	else
	{
		i = gt_event_read(code , tn, 1, buff, 200);
		if (i == 0)
			return 0;
		memmove(buff, buff + 16, i - 16);
		TimeToBcd(time(0), buff + 6);
		len = 12;
		switch (event_list[seq].data)
		{
			case 3:
				for (i = 0; i < id_num; i++)
				{
					gt_para_process(tn, id_list[i], (U8 *)&data, 4, 'r', 0);
					data = bcd2bin32(data);					
					memcpy(&temp, &buff[len], 4);
					temp = bcd2bin32(temp);
					if (data < temp)
						data += 1000000;
					data -= temp;
					data = bin2bcd32(data);
					memcpy(&buff[len], &data, 4);
					len += 4;
				}
				break;
			case 5:
				
				break;			
			default:
				break;
		}
	}
	return gt_event_write(code, tn, buff, len, new_record);
}













 
int gt_event_init()
{
	int fp = 0;
	int ret = 0, len;
	
	for (len = 0; len < 21; len++)
	{
		if (event_list[len].code < 0xE2010001 || event_list[len].code > 0xE20100FF)
			gt_printf("\nevent code 0x%08X is not exit", event_list[len].code);
	}

	if (EventFileLock(200) != 1)
		return 0;	
	fp = yaffs_io_open("EventInfo.bin", "r+");
	if (fp == 0)
	{
		ret = InitEventFile();
	}
	else
	{
		ret = yaffs_io_close(fp);
	}
	EventFileUnlock();
	return ret;
}















 
static int event_read(U32 code, int tn, int index, void *dst, int len, int func)
{
	int fp_info = 0, fp_data = 0;
	int ret = 0, event_data_addr, index_offset, i, index_tn;
	U16 event_len, read_tn;
	char *temp = (char *)dst;
		
	if (code < 0xE2010001 || code > 0xE20100FF)
		return 0;
	for (i = 0; i < 21; i++)
	{
		if (event_list[i].code == code)
			break;
	}
	if (i >= 21)
		return 0;
	if (index > 10)
		return 0;
#line 1140 "..\\app\\gt_alarm\\gt_event.c"
	index_tn = tn;
	if (tn > (11 - 1))
		return 0;	

	
	if (EventFileLock(200) != 1)
		return 0;
	fp_info = yaffs_io_open("EventInfo.bin", "r+");
	if (fp_info == 0)
	{

		gt_printf("\nread event no file");

		goto event_ret;
	}
	if (fs_io_read(temp, 1, 1, fp_info) != 1)
	{
		goto event_ret;	
	}
	if (temp[0] == 0)
		fp_data = yaffs_io_open("Event0.bin", "r+");
	else
		fp_data = yaffs_io_open("Event1.bin", "r+");		
	if (fp_data == 0)
	{
		goto event_ret;
	}

	index_offset = 32 					+ (index_tn * 10 * 21 + i * 10 + index - 1) 					* 7;


	
	if (yaffs_io_seek(fp_data, index_offset, 0) != 0)
	{
		goto event_ret;
	}	
	if (fs_io_read(temp, 1, 7, fp_data) != 7)
	{
		goto event_ret;	
	}
#line 1188 "..\\app\\gt_alarm\\gt_event.c"
	memcpy(&event_len, temp + 3, 2);		
	if ((event_len == 0) || (func == 0))
	{
		ret = event_len;
		goto event_ret;
	}

	event_data_addr = 0;
	memcpy(&event_data_addr, temp, 3);
	if (yaffs_io_seek(fp_data, event_data_addr, 0) != 0)
	{
		goto event_ret;
	}	
	if (len < event_len)
		event_len = len;
	if (fs_io_read(dst, 1, event_len, fp_data) != event_len)
	{
		goto event_ret;	
	}		
	ret = event_len;
event_ret:
	if (fp_info != 0)
		yaffs_io_close(fp_info);
	if (fp_data != 0)
		yaffs_io_close(fp_data);	
	EventFileUnlock();
	return ret;
} 












 
int gt_event_len(U32 code, int tn, int index)
{
	char temp[8];
	
	if (index > 10)
		return 0;
	return event_read(code ,tn, index, temp, 0, 0);
}














 
int gt_event_read(U32 code, int tn, int index, void *dst, int len)
{
	if (index > 10)
		return 0;
	return event_read(code ,tn, index, dst, len, 1);
}









 
int gt_event_total(U32 code, int tn)
{
	int fp_info = 0, fp_data = 0;
	int ret = 0, read_addr, index_offset, i, index_tn, total_index;
	U16 read_len, read_tn, tn_s, tn_e;
	char *buff = event_new_index_buff;

	if (code < 0xE2010001 || code > 0xE20100FF)
		return 0;
	if (code != 0xE20100FF)
	{
		for (i = 0; i < 21; i++)
		{
			if (event_list[i].code == code)
				break;
		}
		if (i >= 21)
			return 0;	
	}
#line 1293 "..\\app\\gt_alarm\\gt_event.c"
	index_tn = tn;
	if (tn > (11 - 1))
		return 0;	

	
	if (EventFileLock(200) != 1)
		return 0;
	fp_info = yaffs_io_open("EventInfo.bin", "r+");
	if (fp_info == 0)
	{

		gt_printf("\nevent total no file");

		goto event_ret;
	}
	if (fs_io_read(buff, 1, 1, fp_info) != 1)
	{
		goto event_ret;	
	}
	if (buff[0] == 0)
		fp_data = yaffs_io_open("Event0.bin", "r+");
	else
		fp_data = yaffs_io_open("Event1.bin", "r+");		
	if (fp_data == 0)
	{
		goto event_ret;
	}

	if (code == 0xE20100FF)
	{




		if (tn == 0xFFFF)
		{
			tn_s = 0;
			tn_e = 11;
		}
		else
		{
			tn_s = tn;
			tn_e = tn + 1;
		}

		total_index = 10 * 21 * (tn_e - tn_s);
		index_offset = 32;
		for (;total_index > 0; )
		{
			if (total_index > 200)
				i = 200;
			else
				i = total_index;
			if (yaffs_io_seek(fp_data, index_offset, 0) != 0)
			{
				goto event_ret;
			}			
			if (fs_io_read(buff, 1, 7 * i, fp_data) != 7 * i)
			{
				goto event_ret;	
			}					
			index_offset += i * 7;
			total_index -= i;
			read_addr  = 0;
			for (; i > 0; i--)
			{
				memcpy(&read_addr, buff + (i - 1) * 7, 3);
				if (read_addr == 0 || read_addr == 0xFFFFFF)
					continue;		
				memcpy(&read_len, buff +  (i - 1) * 7 + 3, 2);
				if (read_len == 0 || read_len == 0xFFFF)
					continue;
				memcpy(&read_tn, buff + (i - 1) * 7 + 3 + 2, 2);
				if (tn != 0xFFFF)
				{
					if (read_tn != tn)
						continue;	
				}
				ret++;
			}			
		}
	}
	else
	{
		index_offset = 32 						+ (index_tn * 10 * 21 + i * 10) 						* 7;


		if (yaffs_io_seek(fp_data, index_offset, 0) != 0)
		{
			goto event_ret;
		}	
		if (fs_io_read(buff, 1, 7 * 10, fp_data) != 7 * 10)
		{
			goto event_ret;	
		}








		read_addr  = 0;
		for (i = 0; i < 10; i++)
		{
			memcpy(&read_addr, buff + i * 7, 3);
			if (read_addr == 0 || read_addr == 0xFFFFFF)
				continue;		
			memcpy(&read_len, buff + i * 7 + 3, 2);
			if (read_len == 0 || read_len == 0xFFFF)
				continue;
			memcpy(&read_tn, buff + i * 7 + 3 + 2, 2);
			if (read_tn != tn)
				continue;	
			ret++;
		}
	}
	
event_ret:
	if (fp_info != 0)
		yaffs_io_close(fp_info);
	if (fp_data != 0)
		yaffs_io_close(fp_data);	
	EventFileUnlock();
	return ret;
}










 
int gt_event_clear()
{
	int ret;
	
	if (EventFileLock(200) != 1)
		return 0;
	ret = fs_io_unlink("EventInfo.bin");
	fs_io_unlink("Event0.bin");
	fs_io_unlink("Event1.bin");
	InitEventFile();
	EventFileUnlock();
	return ret;
}




 
